Hi all,
  I got a ParseException when I query solr with Lucene BooleanQuery
expression (toString()).

I use the default parser : LuceneQParserPlugin,which should support whole
lucene syntax,right?

Java Code:

BooleanQuery bq = new BooleanQuery();
Query q1 = new TermQuery(new Term("I_NAME_ENUM", "KFC"));
Query q2 = new TermQuery(new Term("I_NAME_ENUM", "MCD"));
bq.add(q1, Occur.SHOULD);
bq.add(q2, Occur.SHOULD);
bq.setMinimumNumberShouldMatch(1);
String solrQuery = bq.toString();

query string is : q=(I_NAME_ENUM:kfc I_NAME_ENUM:best western)~1

Exceptions :

*message* *org.apache.lucene.queryParser.ParseException: Cannot parse
'(I_NAME_ENUM:kfc I_NAME_ENUM:best western)~1': Encountered " <FUZZY_SLOP>
"~1 "" at line 1, column 42. Was expecting one of: <EOF> <AND> ... <OR> ...
<NOT> ... "+" ... "-" ... "(" ... "*" ... "^" ... <QUOTED> ... <TERM> ...
<PREFIXTERM> ... <WILDTERM> ... "[" ... "{" ... <NUMBER> ... *

*description* *The request sent by the client was syntactically incorrect
(org.apache.lucene.queryParser.ParseException: Cannot parse
'(I_NAME_ENUM:kfc I_NAME_ENUM:best western)~1': Encountered " <FUZZY_SLOP>
"~1 "" at line 1, column 42. Was expecting one of: <EOF> <AND> ... <OR> ...
<NOT> ... "+" ... "-" ... "(" ... "*" ... "^" ... <QUOTED> ... <TERM> ...
<PREFIXTERM> ... <WILDTERM> ... "[" ... "{" ... <NUMBER> ... ).*

*
*

Anyone could help?


Thanks

Kun

*
*

Reply via email to