Hi Chris

Thanks a lot for the mail.

I did not quite understand how that function was made. But, it does work
like you said - there is a sorted list of documents now, where documents
around value 20 are ranked first and documents around 10 are ranked below.
(I chose a field with 0 and 100 as limits and tried with that. So, replaced
infinities with 0 and 100 respectively)

sort=map(map(myNumField,-Infinity,10,0),20,Infinity,0) desc, score desc

If I needed Sorted results in ascending order, Results around the value 10
ranked above those of 20, what should I do in this case?

I tried giving,
sort=map(map(myNumField,-Infinity,10,0),20,Infinity,0) *asc*, score desc
But, that does not seem to work quite as I expected.

S.


On Mon, Aug 22, 2011 at 9:48 PM, Chris Hostetter
<hossman_luc...@fucit.org>wrote:

>
> : 1) The user gives a query, and also has an option to choose the "from"
> and
> : "to" values for a specific field.
> : (For Eg: Give me all documents that match the query Solr Users, but with
> : those that were last updated between 10th and 20th of August ranked on
> top)
> :
> : -Over here, I am currently using a BoostQuery functionality, to do this.
> : However, along with this, I want to provide an additional option of
> Sorting
> : these "boosted" results based on that range chosen above.
>
> This should be doable using sort by function, but obviously you'd have to
> decide which "end" of the range should score higher.
>
> the key would be to:
>  * use a primary and a secondary sort
>  * secondary sort is simple "score desc"
>  * primary sort is on a function over the field whose range you care about
>  * primary sort function needs to map all values out of the range to a
> constant value so secondary sort applies.
>
> I haven't tested this out, but i think the "map" function should make this
> relatively straight forward...
>
> sort=map(map(myNumField,-Infinity,10,0),20,Infinity,0) desc, score desc
>
> Assuming "-Infinity" and "Infinity" are actaully legal values in functions
> (if they aren't you'd need to pick some upper/lower limits) that should
> sort any doc where "myNumField" is between 10 and 20 first, with docs
> matching "20" sorting at the top above docs matching "19, 18, ... 10" and
> then after those docs all remaining matching docs will sort by score.
>
>
> -Hoss
>



-- 
Sowmya V.B.
----------------------------------------------------
Losing optimism is blasphemy!
http://vbsowmya.wordpress.com
----------------------------------------------------

Reply via email to