On Friday 28 March 2003 15:48, Shah, Vineel wrote: > One of my clients is asking for an old-style boolean query search on my > keywords fields. A string might look like this: > > "oracle admin*" and java and oracle and ("8.1.6" or "8.1.7") and > ("solaris" or "unix" or "linux") > > There would probably be need for nested parenthesis, although I can't think > of an example. Is there a parser I can plug into lucene to make this > happen? It doesn't seem like the normal QueryParser class would like this > string, or would it? Any ideas or comments would be appreciated. Making my
Actually I think it should, as long as you change 'and' to 'AND' and 'or' to 'OR' (upper case versions are used, I think, to make it less likely user meant to match words 'and' and 'or'?). > own grammar and parser class is too expensive a proposition. Well, writing simple grammar and parser is fairly easy to do, if you've ever used java_cup or javacc (or just (b)yacc / bison), shouldn't take all that long since all actual query classes already exist. But I don't think you need to do even that. :-) The only feature that might need some additional work is matching "oracle admin*"; PhrasePrefixQuery allows doing something like that, but it's not integrated with QueryParser (I think it probably should, and might be quite easy to do). -+ Tatu +- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]