On Thursday 25 August 2005 09:14, WolfgangTäger wrote: > Hello Paul, hello Doug, > > many thanks for your help !! > > @Paul: I didn't try your method, Paul, because I feared that retrieving > all hits would not solve my problems, because the number of hits may be > many times higher than the 2000 I wanted for my statistics. > > > @Doug: I tried your method which is extremely fast ! > > The first run is still very slow (many seconds, but this is not a problem > for me), measuring the following ones sometimes gives 0ms using > currentTimeMillis() !!
The method I gave is to try to optimize the first reading from disk. I'd expect FieldCache to use it. > > > Now I have one more question: I want to use the TopDocs result > > TopDocs hits = searcher.search(query, (Filter)null, 2000); > > as a filter for following queries like > > DE:Schlüssel limited to the 2000 TopDocs for the query "key" > > AFAIK, the recommended way for search within a search is: > Combine the previous query with the current query using BooleanQuery, > wherein the previous query is marked as required. > > Can this be done in this case ? My query does not contain any information > that I want 2000 results as maximum. > Note: I do not want to limit the combined query to 2000, but typically I > expect fewer results by first restricting the "key" query to 2000 and then > looking in the results for DE:"Schlüssel". Have a look at QueryFilter and FilteredQuery, they fit nicely here. Regards, Paul Elschot
