The statement
final Query query = QueryParser.parse("+strong +will",
"field",
new StandardAnalyzer());
Generates the following exception:
com.lucene.queryParser.ParseException: Encountered "<EOF>" at line 0, column
13.
Was expecting one of:
<TERM> ...
<QUOTE> ...
<OPEN> ...
at
com.lucene.queryParser.QueryParser.generateParseException(QueryParser.java:4
27)
at
com.lucene.queryParser.QueryParser.jj_consume_token(QueryParser.java:314)
at com.lucene.queryParser.QueryParser.subQuery(QueryParser.java:195)
at com.lucene.queryParser.QueryParser.Query(QueryParser.java:152)
at com.lucene.queryParser.QueryParser.parse(QueryParser.java:54)
at cg.facility.search.test.CodeTest.main(CodeTest.java:60)
at java.lang.reflect.Method.invoke(Native Method)
at com.borland.jbuilder.util.BootStrap.invokeMain(Unknown Source)
at com.borland.jbuilder.util.BootStrap.main(Unknown Source)
It seems that the problem happens because the StanadrdAnalyzer uses the
StopFilter that
removes the word 'will'. As a result, the query parser sees "+strong +" and
complains.
This is a general problem with any analyzer that eliminates tokens. Possibly
similar problems
may occur with a analyzers that generates tokens (e.g. the token 'rock' is
translated into two tokens,
'music', 'stone').
This violates the rule of using the same analyzer for both indexing and
search.
Should I file a report for it ?
Ta;
_______________________________________________
Lucene-dev mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/lucene-dev