One things is the index searcher may not show new documents added. You will have to re-open the index searcher.
Also take a look at the following document: http://wiki.apache.org/lucene-java/ImproveSearchingSpeed On Wed, Jan 13, 2010 at 6:16 PM, Artem Chereisky <[email protected]>wrote: > Hi, > > Given a boolean query and/or a filter, what is the best way to see if there > is at least one matching document? > > I tried a simple hit collector which sets a flag on the first Collect > method. Ideally I would want to stop collecting at that point but I > couldn't > find a way of doing that. > I also tried: TopDocs docs = _searcher.Search(query, filter, 1), but it > seems to iterate through all matches as docs.totalHits is set the the > actual > number of matches. > > So, is there a better way > > Regards, > Art >
