lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roy Ward <...@buymusichere.com>
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 Hits.java 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:

if(hits.hasNext())
{
    Hit hit = (Hit)hits.next();
    float s = hit.getScore();
    ...
}

throws the following exception (line numbers are the patch against
lucene-2.2):

java.lang.ArrayIndexOutOfBoundsException: 1 >= 1
        at org.apache.lucene.search.Hits.score(Hits.java:125)
        at org.apache.lucene.search.Hit.getScore(Hit.java:68)
<snip>

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.
<snip>
> 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
trunk).

Roy Ward
-- 
View this message in context: http://www.nabble.com/-jira--Created%3A-%28LUCENE-997%29-Add-search-timeout-support-to-Lucene-tf4438431.html#a13285307
Sent from the Lucene - Java Developer mailing list archive at Nabble.com.


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


Mime
View raw message