You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Niraj Alok <ni...@emacmillan.com> on 2005/03/03 12:45:53 UTC

problem with not operator

Hi,

When I am putting the query as 'a not b' there are some documents coming up
which have 'b' as well.

I am searching on 3 fields using a MultiFieldQueryParser and while debugging
the query is also getting shown as
(field1:a -field1:b) (field2:a -field2:b) (field3:a -field3:b)

Yet the results have documents which contain 'b' terms as well.

While indexing, I am using StandardAnaylzer(stopwords), and the field as:
Field fl = new Field("indexhd",indexhd, true, true, true);

etc..

Please could you suggest what the problem could be?



Regards,
Niraj

Re: problem with not operator

Posted by Morus Walter <mo...@tanto.de>.
Niraj Alok writes:
> Hi,
> 
> When I am putting the query as 'a not b' there are some documents coming up
> which have 'b' as well.
> 
> I am searching on 3 fields using a MultiFieldQueryParser and while debugging
> the query is also getting shown as
> (field1:a -field1:b) (field2:a -field2:b) (field3:a -field3:b)
> 
> Yet the results have documents which contain 'b' terms as well.
> 
That searches for documents having
a in field1 but not b in field1 OR a in field2 but not b in field2 ...

so a document having one field with a but without b will be found even if
it contains b in some other field.
> 
> Please could you suggest what the problem could be?
> 
You need a query
(field1:a OR field2:b OR field3:c) -(field1:b OR field2:b OR field3:c)

I'm not familliar with MFQP, so I cannot say if it can help you with that.

Morus

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


Re: problem with not operator

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Try using an IndexSearcher.explain on a document in the search results 
that you know has "b" - this will give you the gory details of why.

Also, try to simplify without MultiFieldQueryParser - its got plenty of 
known issues - for now and see what that gives you.

	Erik

On Mar 3, 2005, at 6:45 AM, Niraj Alok wrote:

> Hi,
>
> When I am putting the query as 'a not b' there are some documents 
> coming up
> which have 'b' as well.
>
> I am searching on 3 fields using a MultiFieldQueryParser and while 
> debugging
> the query is also getting shown as
> (field1:a -field1:b) (field2:a -field2:b) (field3:a -field3:b)
>
> Yet the results have documents which contain 'b' terms as well.
>
> While indexing, I am using StandardAnaylzer(stopwords), and the field 
> as:
> Field fl = new Field("indexhd",indexhd, true, true, true);
>
> etc..
>
> Please could you suggest what the problem could be?
>
>
>
> Regards,
> Niraj


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