You don't say whether you want to change the value in the index, or the
value that you return from the index (i.e, at query time).

If you want to change the value that you place in the index, you could
modify your SQL query to use the ROUND() function on the "ratings" value.
For Oracle, you could just use ROUND(ratings), while SQLServer appears to
require something like CONVERT(int, ROUND(ratings, 0)).

If you want to return a rounded value as part of the query result, you
could specify the list of fields to return (parameter "fl"), and specify
something like "rint(ratings)".

Note: for Oracle and SQLServer, ROUND() rounds *.5 upwards (which is the
way that I have been taught is correct), while rint() rounds *.5 downwards
(which is what you appear to want).



On Thu, Aug 1, 2013 at 8:37 AM, Thyagaraj <thyagara...@gmail.com> wrote:

> I'm using solr 4.0 with DIH jdbc connector and I use Solr Admin web
> interface
> for testing. I have a field called *ratings* which varies like 0, 0.3, 0.5,
> 0.75, 1, 1.5, 1.6... and so on as per user input.
>
>
> I found the link
> http://lucene.472066.n3.nabble.com/How-to-round-solr-score-td495198.html
> <http://lucene.472066.n3.nabble.com/How-to-round-solr-score-td495198.html>
> which is beyond of my understanding and I unable to make use of in my case.
>
>
> I just want to round this rating values to nearest integer value through
> solr like,
> 0.3 & 0.5 to 0
> 0.75 & 1.5 to 1
> 1.6 to 2
>
>
> Anybody help me guiding please?
>
> Thank you!
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-round-ratings-to-nearest-integer-value-tp4081833.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Reply via email to