lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roy Ward <>
Subject Re: [jira] Commented: (LUCENE-997) Add search timeout support to Lucene
Date Thu, 18 Oct 2007 22:55:15 GMT

Sean Timm wrote:

>> (2) Estimating the the number of results <snip>

>Is there a test case that shows this breakage, or can you point me to 
>the code in that my patch causes problems with?  Sorry, I'm 
>not seeing it.

In the case of no hits at all getting returned, the following code:

    Hit hit = (Hit);
    float s = hit.getScore();

throws the following exception (line numbers are the patch against

java.lang.ArrayIndexOutOfBoundsException: 1 >= 1

which is thrown by:

    return hitDoc(n).score;

I haven't worked through this fully (and I haven't yet put this into a nice
test case I can send you - I'm testing this within a large application), but
I think it's related to the number of estimated hits being different than
the actual number of hits, so some code doesn't check that there are enough
hits (and user code might do this too). The problem does not occur when a
search that actually returns zero hits is done.

> I wouldn't expect anyone to actually use a 1 ms resolution.
> If that isn't preempted until 1.1 seconds  have elapsed,
> I think my operations team will still be happy.

This one is no big deal, since as you point out, it's really to stop the
tiny proportion of queries that don't finish in a reasonable time, but I was
thinking of a couple of things here:

If there's going to be a timer thread running in an application, other
things may want to make use of it (such as reporting elapsed times), so some
accuracy might be good.

Also, it's nice to have it somewhat bulletproof - If someone makes the
mistake of using a resolution of 1ms (I tested it for curiosity), on a
heavily loaded system with many threads running that resulted in about 7000
ticks every minute, so it was wrong by a factor of about 8.

If I find time time to put something in the timer class to get good accuracy
without too much performance loss, I'll send you a patch (I'm sorry I
haven't done so already, but I'm patching against 2.2 rather than the cvs

Roy Ward
View this message in context:
Sent from the Lucene - Java Developer mailing list archive at

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

View raw message