lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raul Raja Martinez <doblee...@estudiowebs.com>
Subject Re: Multisearch
Date Mon, 06 Mar 2006 22:09:22 GMT
Wouldn't it make sense to have a Hit know where he came from
such as hit.getIndex() instead of having to invoke subSearcher or subDoc?

Just a thought

Erik Hatcher wrote:
> On Mar 6, 2006, at 10:05 AM, WATHELET Thomas wrote:
>> I made a multi search into my Lucene index. It's work properly but I
>> would like to know if it's possible to know in witch index de document
>> belong to.
> 
> This just came up the other day as well, and was covered in the past.  
> Here's the thread with the answer:
> 
>     <http://www.nabble.com/Determine-the-index-of-a-hit-after-using-MultiSearcher-t638218.html#a1706027>

> 
> 
> And here are the relevant snippets:
> 
>        MultiSearcher searcher = (MultiSearcher) 
> context.getAttribute("searcher");
>        IndexReader[] readers = (IndexReader[]) 
> context.getAttribute("readers");
> 
>        Hits hits = searcher.search(query);
> 
> 
> // later while iterating through Hits...
> 
>       int indexIndex = searcher.subSearcher(hits.id(position));
> 
> 
> Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message