lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Morus Walter <morus.wal...@tanto.de>
Subject Re: Limiting hit count
Date Fri, 13 Feb 2004 12:52:31 GMT
lucene@nitwit.de writes:
> On Friday 13 February 2004 12:18, Julien Nioche wrote:
> > If you want to limit the set of Documents you're querying, you should
> > consider using Filter objects and send it to the searcher along with your
> > Query.
> 
> Hm, hard to find information about Filters...I actually only want the first 
> hit:
> 			
> public BitSet bits(IndexReader reader) throws IOException
> {
> 	BitSet bs = new BitSet(1); 
> 	bs.set(1);
> 	return bs;
> }
> 
> ...doesn't work (i.e. returns nothing rather than all hits).
> 
Well that means that you only want document with document id 1 given that
it matches the query.

A filter provides means to restrict *query* to certain documents, not
results. And it won't have influcene on the performance (except for the
time it takes to create the filter and that it slows down things a little 
bit).

As far as results are concerned Lucenes hits object will only hold a 
limited number of result (IIRC 200) and repeat the query if you
access more (look at the search implementation for details) as Julien
already stated.

What's the reason for your question?
Usually lucene executes queries very fast. I typically have a few ms.
So there's few reason to speed this up.
Accessing results is much slower, especially if there are a lot of results
and you access them all.
E.g. query: 1 ms, reading three fields for 50 results: 22 ms.
The index is smaller than the machines memory (~ 3/4 GB Index size, 1 GB RAM).

Morus

---------------------------------------------------------------------
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