I'm building my own BooleanQuery (rather than using Query Parser). That's because I need different defaults from my users:
If a user types: java program
I need to run the query: +java* +program* (namely AND search, with Prefix so as to hit "programS", "programMER").
So naively I split the user's input into words, and build my query term-by-term:
String words= userInput.split(" ");
BooleanQuery query=new BooleanQuery();
for(String word: words)
query.add(new PrefixQuery(new Term("topic", word)), Occur.MUST);
But since my index is built with StandardAnalyzer, I'm having trouble with Stop Words.
If the user types: program of java
Then of course my query (+program* +of* +java+) returns zero results.
Is there an easy solution?
I'd like to keep using StandardAnalyzer (I don't want to index by stupid keywords such as "of"). I would just like stop-words to be removed from my query (as QueryParser does).
Is there some utility method for this? Direct access to the list of stop-words?
Bored stiff? Loosen up...
Download and play hundreds of games for free on Yahoo! Games.