You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by David Townsend <da...@magus.co.uk> on 2004/05/10 14:13:46 UTC

Returning Separate Hits from Multisearcher

We have a number of small indices and also an uber-index made up of all the smaller indices.  We need to get do a search across a number of the sub-indices and get back a hit count from each.  Currently we search  each index, we've also tried running multiple queries against the uber-index, with a field denoting which subindex we are interested in. Obviously this approach is very slow.  Is there any way to use MultiSearcher to do this?  The problem we currently have with MultiSearcher is there seems no way to tell how many hits came from each index.  Is there a recommended way to do this, or should we modify MultiSearcher to return information about the hits on each index.

any ideas?

David Townsend



Re: Returning Separate Hits from Multisearcher

Posted by Ype Kingma <yk...@xs4all.nl>.
On Monday 10 May 2004 14:13, David Townsend wrote:
> We have a number of small indices and also an uber-index made up of all the
> smaller indices.  We need to get do a search across a number of the
> sub-indices and get back a hit count from each.  Currently we search  each
> index, we've also tried running multiple queries against the uber-index,
> with a field denoting which subindex we are interested in. Obviously this
> approach is very slow.  Is there any way to use MultiSearcher to do this? 
> The problem we currently have with MultiSearcher is there seems no way to
> tell how many hits came from each index.  Is there a recommended way to do
> this, or should we modify MultiSearcher to return information about the
> hits on each index.
>
> any ideas?

You can use MultiSearcher.subSearcher(int docNr), evt. combined with a
mapping back from the subSearchers to their original index.

When you only need the count per subSearcher there is no need
for a Hits object. A HitCollector will do nicely.

Have fun,
Ype


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


Re: Returning Separate Hits from Multisearcher

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On May 10, 2004, at 8:13 AM, David Townsend wrote:
>
> We have a number of small indices and also an uber-index made up of 
> all the smaller indices.  We need to get do a search across a number 
> of the sub-indices and get back a hit count from each.  Currently we 
> search  each index, we've also tried running multiple queries against 
> the uber-index, with a field denoting which subindex we are interested 
> in. Obviously this approach is very slow.  Is there any way to use 
> MultiSearcher to do this?  The problem we currently have with 
> MultiSearcher is there seems no way to tell how many hits came from 
> each index.  Is there a recommended way to do this, or should we 
> modify MultiSearcher to return information about the hits on each 
> index.
>
> any ideas?

Instead of running multiple queries against the uber-index, try making 
a single "uber" query that builds up boolean query clauses that select 
each of the small "index" fields you're interested in.

Also, perhaps using a Filter to narrow down the search space on the 
uber-index is more along the lines of what you're after?

	Erik



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