lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeremy Meyer (JIRA)" <>
Subject [jira] Commented: (LUCENE-520) Ability to abort hit collection
Date Thu, 16 Mar 2006 17:38:59 GMT
    [ ] 

Jeremy Meyer commented on LUCENE-520:

I use it in my code and it seems to work fine for me. We used to do the throwing an exception
thing but the particularly bad thing in this case is that HitCollector.collect doesn't declare
that it throws any exceptions so you have to throw a runtime exception and then catch that
runtime exception in the outer code. This is fine other than it is generally considered bad
practice to catch runtime exceptions. 

As far as Yonik's comment goes, that maybe true but often times it is still nice to adhere
to the common pattern of using a hit collector. It is fairly easy to imagine a case where
you have a custom hit collector that is working fine for you. Then one day you get a new requirement
that under certain conditions you should terminate the search. For me, the easiest way is
to add just a little bit of code to the hit collector I already have and be done with it.
For instance, our interface makes it possible to do a search that will essentially hit almost
all of the records. This takes 10-20 seconds and slows any other searches that may be going
on down. We simply added code to the hit collector to say once we have collected some large
number of hits just cut off the rest of the search. The hits we return may not be the real
top hits, but if they are getting that many results it probably isn't very relevant anyway.
Like I said, for this case, we simply added a bit of code to what we already had and the search
was cut short.

> Ability to abort hit collection
> -------------------------------
>          Key: LUCENE-520
>          URL:
>      Project: Lucene - Java
>         Type: Improvement
>   Components: Search
>     Versions: 1.9
>     Reporter: Eric Jain
>     Priority: Minor

> If the HitCollector.collect method returned a boolean value rather than void, this value
could be used to determine whether any further hits should be reported. This would speed up
things a bit when all you need is a confirmation that a query produces some hits (e.g. for
generating suggestions).

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

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

View raw message