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 Nick Atkins <Ni...@scalix.com> on 2006/03/22 21:16:47 UTC
Query for a non-value
Hi there,
How do I do a query for the value of a field not being equal to
something? For example, we all do Query("field:value") but I want to do
Query("NOT field:value") to essentially return all the documents that do
not have fields with this value? I've tried this but Lucene always
returns no documents when I know there are plenty of documents without
that field set to that value.
Many thanks,
Nick.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Query for a non-value
Posted by Daniel Noll <da...@nuix.com.au>.
Nick Atkins wrote:
> Hi there,
>
> How do I do a query for the value of a field not being equal to
> something? For example, we all do Query("field:value") but I want to do
> Query("NOT field:value") to essentially return all the documents that do
> not have fields with this value? I've tried this but Lucene always
> returns no documents when I know there are plenty of documents without
> that field set to that value.
Presumably you're referring to the QueryParser not properly handling the
case where all clauses are prohibited.
The answer to this has been on the list many times, I answered exactly
the same question only a short while ago, it involves overriding the
QueryParser.
Daniel
--
Daniel Noll
Nuix Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia Ph: +61 2 9280 0699
Web: http://www.nuix.com.au/ Fax: +61 2 9212 6902
This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Query for a non-value
Posted by Otis Gospodnetic <ot...@yahoo.com>.
Nick,
FAQ entry: http://wiki.apache.org/jakarta-lucene/LuceneFAQ#head-0cda565d913389773ca9c3246bde894c3e99084e
Otis
----- Original Message ----
From: Nick Atkins <Ni...@scalix.com>
To: java-user@lucene.apache.org
Sent: Wednesday, March 22, 2006 3:16:47 PM
Subject: Query for a non-value
Hi there,
How do I do a query for the value of a field not being equal to
something? For example, we all do Query("field:value") but I want to do
Query("NOT field:value") to essentially return all the documents that do
not have fields with this value? I've tried this but Lucene always
returns no documents when I know there are plenty of documents without
that field set to that value.
Many thanks,
Nick.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org