Re: Lucene Query Wrong Result for phrase.

2014-07-18 Thread Ian Lea
Probably because something in the analysis chain is removing the
hyphen.  Check out the javadocs.  Generally you should also make sure
you use the same analyzer at index and search time.


--
Ian.


On Fri, Jul 18, 2014 at 6:52 AM, itisismail it.is.ism...@gmail.com wrote:
 Hi I have created index with 1 field with simple message like (hello - world)
 now when I create for search like +body: \hello world\  I should not
 get any result because I have wrapped my search word in double quotes and
 does not specify dash(-) between (hello and world) but I am still getting
 that result.I am using Lucene version 3.0  using snowball analyzer, also
 use Cosntruct query likeString qry=+body:\hello world\;Query query = new
 QueryParser(Version.LUCENE_30, body, analyzer).parse(qry);Why lucene is
 ignoring dash(-) while search is a phrase.



 --
 View this message in context: 
 http://lucene.472066.n3.nabble.com/Lucene-Query-Wrong-Result-for-phrase-tp4147842.html
 Sent from the Lucene - Java Users mailing list archive at Nabble.com.

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



Re: Lucene Query Wrong Result for phrase.

2014-07-18 Thread itisismail
Thanks IanI am using  same analyzer for both indexing  searching. Problem is
either I search hello world or hello-world or hello:world or hello,world in
all cases I am getting same result. All of the queries are wrapped in double
quotes. Actuall message indexed is hello - world.Also I am using
phrasequery.



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Lucene-Query-Wrong-Result-for-phrase-tp4147842p4147906.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

Re: Lucene Query Wrong Result for phrase.

2014-07-18 Thread Jack Krupansky
The standard tokenizer will strip off those escaped quotes at query time. 
Ditto for the hyphen at index time.


Try constructing your own analyzer using the white space tokenizer instead 
of the standard tokenizer.


-- Jack Krupansky

-Original Message- 
From: itisismail

Sent: Friday, July 18, 2014 1:52 AM
To: java-user@lucene.apache.org
Subject: Lucene Query Wrong Result for phrase.

Hi I have created index with 1 field with simple message like (hello - 
world)

now when I create for search like +body: \hello world\  I should not
get any result because I have wrapped my search word in double quotes and
does not specify dash(-) between (hello and world) but I am still getting
that result.I am using Lucene version 3.0  using snowball analyzer, also
use Cosntruct query likeString qry=+body:\hello world\;Query query = new
QueryParser(Version.LUCENE_30, body, analyzer).parse(qry);Why lucene is
ignoring dash(-) while search is a phrase.



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Lucene-Query-Wrong-Result-for-phrase-tp4147842.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com. 



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