lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From news...@hotu.com
Subject Re: query matching all documents
Date Wed, 21 May 2003 19:56:40 GMT
Since this question has gone unanswered, should I assume that such a 
query is not possible with the existing Lucene version?

newsham@hotu.com wrote:

>
> Is there a query object which can match all documents?
>
> As an example, suppose my search supports zero or more search 
> criteria.  Each criteria, if specified, is required to match the 
> document.  If no criteria are specified, all documents should be 
> returned.  Here's an example (NullQuery is an imaginary class which 
> represents the query type I'm looking for):
>
> BooleanQuery query = new BooleanQuery();
> query.add(new NullQuery(), true, false);
> if (criteria1exists) {
>  query.add(..., true, false);
> }
> if (criteria2exists) {
>  query.add(..., true, false);
> }
>
> Without line 2, if no criteria is specified, no documents will be 
> returned.  Apparently, a boolean query with no boolean elements 
> matches zero documents.  In my opinion, it would have made more sense 
> for it to match all documents, since each boolean element represents a 
> constraint, and no constraints implies all documents.  But for 
> clarity, maybe there should be an AllQuery and a NoneQuery which match 
> all documents and no documents respectively.
>
> But back to reality, is there a way to achieve this with the existing 
> query classes?  I'd prefer not to add a dummy field to search by, as 
> this is not efficient.
>
> Thanks,
> Jim
>
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message