On Tue, May 12, 2009 at 3:03 PM, Marc Sturlese <marc.sturl...@gmail.com> wrote:
> I have seen that if I set the value of queryResultWindowSize  to 0 in
> solrconfig.xml solr will return an error of divided by zero.

Seems like a configuration error since requesting that results be
retrieved in 0 size chunks doesn't make a lot of sense.

> Checking the source I have seen it can be fixed in SolrIndexSearcher. At the
> end of the function getDocListC it's coded:
>
>        if (maxDocRequested < queryResultWindowSize) {
>          supersetMaxDoc=queryResultWindowSize;
>        } else {
>          supersetMaxDoc = ((maxDocRequested -1)/queryResultWindowSize +
> 1)*queryResultWindowSize;
>          if (supersetMaxDoc < 0) supersetMaxDoc=maxDocRequested;
>        }
>
> I have sorted it oud doing (just addin parenthesis):
>
>        if (maxDocRequested < queryResultWindowSize) {
>          supersetMaxDoc=queryResultWindowSize;
>        } else {
>          supersetMaxDoc = ((maxDocRequested -1)/(queryResultWindowSize +
> 1))*queryResultWindowSize;
>          if (supersetMaxDoc < 0) supersetMaxDoc=maxDocRequested;
>        }
>
> I have seen this is happening in a recent trunk. Is my fix correct?

The +1 really needs to be after the divide (we're rounding up).

If a fix is needed, I imagine it would be at the time that config
parameter is read... if it's less than or equal to 0, then set it to
1.

-Yonik
http://www.lucidimagination.com

Reply via email to