That query searches for ratings in the range 2.0 to 2.5, which does not
include 1.75. The fl setting only affects the returned value, and not the
search.

If you want to search for ratings that would round to 2, your query should
be something like

fq=[1.5 TO 2.5]

Note: the exact boundaries should be chosen with care to ensure that the
values returned match the behaviour of rint(). (rint(1.5) rounds to 2,
while rint(2.5) also rounds to 2 - my guess is that rint() rounds half
towards even; see https://en.wikipedia.org/wiki/Rounding).


On Mon, Aug 5, 2013 at 7:21 AM, Thyagaraj <thyagara...@gmail.com> wrote:

> Hello Erick,
>
> Is it possible to without changing the sql query?. I just rounded ratings
> value at the query time and trying to search with filter query like the one
> below:
>
> q=*:*
> fq=ratings:[2.0 TO 2.5]
> fl=ratings:rint(ratings)
>
> I have a rating 1.75 in a record which is rounded to 2.0 by rint but it's
> not listing when fq is used like the one above. It's just rounding, but I
> also want to query the rounded value.
>
>
> Thank you!
>
>
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-round-ratings-to-nearest-integer-value-tp4081833p4082464.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Reply via email to