lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <>
Subject Re: Help on the ParallelMultiSearcher.rewrite(Query) method
Date Fri, 08 Jul 2005 15:11:23 GMT

On Jul 8, 2005, at 10:32 AM, Terence Lai wrote:
> I have implemented the way as you described, and it is now working  
> probably. However, I have a concern on the performance of my  
> implementation.
> Since I am using parallelMultiSearcher to perform the search. I  
> have no idea on which index directory is corresponding to the  
> document that I am trying to highlight. The way my application  
> works is indicated as follows:

You can get the "index" of the Searchable using:

     int indexIndex = searcher.subSearcher(;   
(borrowed from code)

Where position is the position in the Hits for the document.

> 1) user enter a keyword search criteria for the document contents
> 2) the system returns a list of document titles with hyper links to  
> drill down to the contents.
> 3) upon the user click the hyper link of the individual document,  
> the application will perform the highlight based on the search  
> criteria cached from Step (1)
> Because of this, the application does not keep track of which index  
> directory is associated with the search result document. Currently,  
> I have to make another search using the document primary key to  
> locate the searcher, and using this individual searcher to rewrite  
> my query. However, it invokes an extra search operation which may  
> be costly.

My recommendation is to encode in the drill-down hyperlink the index  
"index" and the document id within that index.

> Therefore, I originally tried to use the  
> ParallelMultiSearcher.rewrite() to convert the query into a  
> primitive form. Doing this way, I don't need to worry about which  
> index directory is belong to the index document. Is there any  
> reason why the method not being supported?

I'm not quite qualified to answer this fully, but rewriting a query  
may involve enumerating the terms and it needs to get those terms  
from an index.  With the MultiSearcher's, which index that would be  
is undefined.

> I am trying to think of an alternative way. Is that possible for me  
> to loop through all the individual searchers and perform an  
> IndexSearcher.rewrite with each searcher. At the end, I create a  
> BooleanQuery to join them together with BooleanQuery(subQuery,  
> false, false); Do you think this will work? Is there any issue if I  
> do this?

That seems unnecessary.  I think the approach of keeping track of  
which index a result came from will work for the situation you've  


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message