lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grotzke <>
Subject Re: ArrayIndexOutOfBoundsException for query with rows=0 and sort param
Date Tue, 30 Nov 2010 13:24:38 GMT
On Tue, Nov 30, 2010 at 10:29 AM, Michael McCandless
<> wrote:
> Hmm this is in fact a regression.
> TopFieldCollector expects (but does not verify) that numHits is > 0.
> I guess to fix this we could fix TopFieldCollector.create to return a
> NullCollector when numHits is 0.

Fixing this in lucene/solr sounds good :-)

Still I'm wondering, why this issue does not occur with the plain
example solr setup with 2 indexed docs. Any explanation?

> But: why is your app doing this?  Ie, if numHits (rows) is 0, the only
> useful thing you can get is totalHits?

Actually I don't know this (yet). Normally our search logic should
optimize this and ignore a requested sorting with rows=0, but there
seems to be a case that circumvents this - still figuring out.

> Still I think we should fix it in Lucene -- it's a nuisance to push
> such corner case checks up into the apps.  I'll open an issue...

Just for the record, this is

One question: as leaving out sorting leads to better performance, this
should also be true for rows=0. Or is lucene/solr already that clever
that it makes this optimization (ignoring sort) automatically? Do I
understand it correctly, that the solution with the null collector
would make this optimiztion?

We're just asking ourselves if we should go ahead and analyze and fix
this in our app or wait for a patch for solr/lucene.
What do you think? Is there like a timeframe when there's an
agreement on the correct solution and a patch available?

Thanx && cheers,

> Mike
> On Mon, Nov 29, 2010 at 7:14 AM, Martin Grotzke
> <> wrote:
>> Hi,
>> after an upgrade from solr-1.3 to 1.4.1 we're getting an
>> ArrayIndexOutOfBoundsException for a query with rows=0 and a sort
>> param specified:
>> java.lang.ArrayIndexOutOfBoundsException: 0
>>        at$StringOrdValComparator.copy(
>>        at$OneComparatorNonScoringCollector.collect(
>>        at
>>        at
>>        at
>>        at org.apache.solr.handler.component.QueryComponent.process(
>>        at org.apache.solr.handler.component.SearchHandler.handleRequestBody(
>>        at org.apache.solr.handler.RequestHandlerBase.handleRequest(
>>        at org.apache.solr.core.SolrCore.execute(
>> The query is e.g.:
>> /select/?sort=popularity+desc&rows=0&start=0&q=foo
>> When this is changed to rows=1 or when the sort param is removed the
>> exception is gone and everything's fine.
>> With a clean 1.4.1 installation (unzipped, started example and posted
>> two documents as described in the tutorial) this issue is not
>> reproducable.
>> Does anyone have a clue what might be the reason for this and how we
>> could fix this on the solr side?
>> Of course - for a quick fix - I'll change our app so that there's no
>> sort param specified when rows=0.
>> Thanx && cheers,
>> Martin
>> --
>> Martin Grotzke

Martin Grotzke

View raw message