lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kun xiong <xiongku...@gmail.com>
Subject HTTP Status 400 - org.apache.lucene.queryParser.ParseException
Date Tue, 18 Jan 2011 09:09:00 GMT
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

*
*

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message