Add qp.setAutoGeneratePhraseQueries = true before calling qp.parse.

Otherwise, the query (clause of the larger BooleanQuery) will be the same as "cla" OR "war", which will match all "war" documents, plus any "cla" documents you may have.

-- Jack Krupansky

-----Original Message----- From: zhoucheng2008
Sent: Tuesday, August 14, 2012 8:29 AM
To: java-user
Subject: Re: Does the string "Cla$$War" affect Lucene?

BooleanQuery bq;
QueryParser qp;
qp = new QueryParser(version, "title", analyzer);
bq.add(qp.parse(QueryParser.escape("Cla$$War")), Occur.valueOf("MUST"));



version = Version.LUCENE_35;
analyzer = new LimitTokenCountAnalyzer(new StandardAnalyzer(
Version.LUCENE_35, CharArraySet.EMPTY_SET),
ERConstants.maxTokenNum);



Is it because of the QueryParser.escape()?




------------------ Original ------------------
From:  "Ian Lea"<ian....@gmail.com>;
Date:  Tue, Aug 14, 2012 04:39 PM
To:  "java-user"<java-user@lucene.apache.org>;

Subject:  Re: Does the string "Cla$$War" affect Lucene?



Sounds extremely unlikely.  What is the query?  What analyzer? What
version of lucene?  What about other strings containing $$?


--
Ian.


On Tue, Aug 14, 2012 at 9:13 AM, zhoucheng2008 <zhoucheng2...@gmail.com> wrote:
Hi,


I have a big index, and when I searched it with a title string "Cla$$War", Lucene became very slow. It doesn't happen when I searched with other title string such as "Gone with Wind". Does the "$$" affect the search performance?


Thanks,
Cheng

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to