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 aaz <x...@interoperate.com> on 2005/02/10 19:02:23 UTC
!= queries
Hi,
I have an index with field "documentNumber". There are 10 documents. One of the documents has documentNumber A5058970
I want to return all matches where documentNumber != A505*. I should get 9 docs back.
I construct a query like
wq = WildcardQuery("documentNumber","a505*")
BooleanQuery bq = new BooleanQuery();
bq.addQuery(wq,false,true);
I always get no results for this type of query.
Ideas?
Re: != queries
Posted by Jason Haruska <jh...@gmail.com>.
If this is a query you need to support often, you could create a field
"x" that contains "x" in every document. Then search on that with your
prohibited query.
If not, you could get the document list by doing your search then
removing all of those documents from a complete set outside of lucene.
On Thu, 10 Feb 2005 11:19:03 -0700, aaz <x...@interoperate.com> wrote:
> Ok, that makes sense. Any suggestions on how to AND that prohibited clause
> with a query to get everything?
>
> ----- Original Message -----
> From: "Miles Barr" <mi...@runtime-collective.com>
> To: "Lucene Users List" <lu...@jakarta.apache.org>
> Sent: Thursday, February 10, 2005 11:07 AM
> Subject: Re: != queries
>
> > On Thu, 2005-02-10 at 11:02 -0700, aaz wrote:
> >> I have an index with field "documentNumber". There are 10 documents. One
> >> of the documents has documentNumber A5058970
> >>
> >> I want to return all matches where documentNumber != A505*. I should get
> >> 9 docs back.
> >>
> >> I construct a query like
> >>
> >> wq = WildcardQuery("documentNumber","a505*")
> >>
> >> BooleanQuery bq = new BooleanQuery();
> >> bq.addQuery(wq,false,true);
> >>
> >> I always get no results for this type of query.
> >>
> >> Ideas?
> >
> > A restriction can only filter out search results and not add to them. So
> > the search is starting with an empty set, then trying to filter out the
> > results with a document number starting A505, i.e. doing nothing.
> >
> >
> >
> >
> > --
> > Miles Barr <mi...@runtime-collective.com>
> > Runtime Collective Ltd.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org
Re: != queries
Posted by aaz <x...@interoperate.com>.
Ok, that makes sense. Any suggestions on how to AND that prohibited clause
with a query to get everything?
----- Original Message -----
From: "Miles Barr" <mi...@runtime-collective.com>
To: "Lucene Users List" <lu...@jakarta.apache.org>
Sent: Thursday, February 10, 2005 11:07 AM
Subject: Re: != queries
> On Thu, 2005-02-10 at 11:02 -0700, aaz wrote:
>> I have an index with field "documentNumber". There are 10 documents. One
>> of the documents has documentNumber A5058970
>>
>> I want to return all matches where documentNumber != A505*. I should get
>> 9 docs back.
>>
>> I construct a query like
>>
>> wq = WildcardQuery("documentNumber","a505*")
>>
>> BooleanQuery bq = new BooleanQuery();
>> bq.addQuery(wq,false,true);
>>
>> I always get no results for this type of query.
>>
>> Ideas?
>
> A restriction can only filter out search results and not add to them. So
> the search is starting with an empty set, then trying to filter out the
> results with a document number starting A505, i.e. doing nothing.
>
>
>
>
> --
> Miles Barr <mi...@runtime-collective.com>
> Runtime Collective Ltd.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org
Re: != queries
Posted by Miles Barr <mi...@runtime-collective.com>.
On Thu, 2005-02-10 at 11:02 -0700, aaz wrote:
> I have an index with field "documentNumber". There are 10 documents. One of the documents has documentNumber A5058970
>
> I want to return all matches where documentNumber != A505*. I should get 9 docs back.
>
> I construct a query like
>
> wq = WildcardQuery("documentNumber","a505*")
>
> BooleanQuery bq = new BooleanQuery();
> bq.addQuery(wq,false,true);
>
> I always get no results for this type of query.
>
> Ideas?
A restriction can only filter out search results and not add to them. So
the search is starting with an empty set, then trying to filter out the
results with a document number starting A505, i.e. doing nothing.
--
Miles Barr <mi...@runtime-collective.com>
Runtime Collective Ltd.
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org