> From: Tal Dayan [mailto:[EMAIL PROTECTED]]
>
> The statement
>
> final Query query = QueryParser.parse("+strong +will",
> "field",
> new StandardAnalyzer());
>
> Generates the following exception:
>
> com.lucene.queryParser.ParseException: Encountered "<EOF>" at
Since "will" is on the stop list, this query will never return any
documents. So I think this should be an error, the problem is that the
error message is uninformative.
To make the message more informative you need to first check to see if there
are stop words in the query, and warn the user of this. You could do this
by constructing a StandardAnalyzer without a stop list, and checking each of
the words that comes out to see if it is a stop word. (I just added a
StandardAnalyzer constructor that lets you specify the stop list, which
makes this easier.)
It's a little ugly to add this generically to QueryParser, since it requires
a lot of knowledge about the analyzer you're using. I suppose we could add
a method like:
QueryParser.parse(String query, String field,
Analyzer withoutStop, Analyzer withStop, String[]
stopWords);
That's a pretty complicated API! Does anyone have better ideas?
Doug
_______________________________________________
Lucene-dev mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/lucene-dev