Lucene Query Wrong Result for phrase.

2014-07-17 Thread itisismail
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

Re: Can phrasequery allow mismatch?

2014-07-17 Thread Michael McCandless
I think you could express this with TermAutomatonQuery (https://issues.apache.org/jira/browse/LUCENE-5815 ) but it's likely very slow to run... Mike McCandless http://blog.mikemccandless.com On Thu, Jul 17, 2014 at 3:22 AM, Yonghui Zhao wrote: > Hi, > > I want to implement a query like phrase

Re: Can phrasequery allow mismatch?

2014-07-17 Thread Ian Lea
Might be able to do it with some combination of SpanNearQuery, with suitable values for slop and inOrder, combined into a BooleanQuery with setMinimumNumberShouldMatch = number of SpanNearQuery instances - 1. So, making this up as I go along, you'd have SpanNearQuery sn1 = B after A, slop 0, in o

Can phrasequery allow mismatch?

2014-07-17 Thread Yonghui Zhao
Hi, I want to implement a query like phrase query with slop 0, but I can allow one term mismatch. For example, the text is "A B C D E" I want to match this text with the query "A B C X E". X mismatches the D. i.e. Query "A B C D E" will match “W1 W2 W3 W4 W5”, the 5 words are consecutive