lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yonik Seeley <>
Subject Re: ArrayIndexOutOfBoundsException for query with rows=0 and sort param
Date Tue, 30 Nov 2010 14:09:58 GMT
On Tue, Nov 30, 2010 at 8:24 AM, Martin Grotzke
<> wrote:
> Still I'm wondering, why this issue does not occur with the plain
> example solr setup with 2 indexed docs. Any explanation?

It's an old option you have in your solrconfig.xml that causes a
different code path to be followed in Solr:

   <!-- An optimization that attempts to use a filter to satisfy a search.
         If the requested sort does not include score, then the filterCache
         will be checked for a filter matching the query. If found, the filter
         will be used as the source of document ids, and then the sort will be
         applied to that. -->

Most apps would be better off commenting that out or setting it to
false.  It only makes sense when a high number of queries will be
duplicated, but with different sorts.


>> 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?

Solr has always special-cased this case and avoided sorting altogether
(for the normal code path... but overlooked it when


View raw message