Hi, I have problem with parsing a text query like this "state-of-the-art -exspensive" where all of the hyphens are handled as NOT short cuts. So I get text:state -text:art -text:exspensive where I ideally would get text:state-of-the-art -text:exspensive, but turning off shortcut syntaxing all together could possibly be acceptable.
Please help me out here, just some hints to where the answer is will also be appreciated.
Thanks!
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35258
7
posted
0
I am guessing that you are using a QueryParser which does this kind of substitution. Can you construct the queries directly, by using a BooleanQuery of two Terms which are joined by "AND NOT"? Or do you need it to be more general than that?
It`s a search string, so I think I need to parse it first....? I`ve also tried to use the WhitespaceAnalyzer with the QueryParser, but it doesn`t seem to preserve the hyphon as it says in the docs.
Thanks
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35258
7
posted
0
Try escaping all Lucene special characters (like +, -, (, ), [, ], ...) with a backslash. Depending on how you do this it may need to be a double backslash in order to work with Javas escaping rules.