I like the solr search result sorted in following order based on it’s age, group by a every 60-days range:
- {0 ~ 59days, randomized inside group}
- {60 ~ 119 days, randomized }
- {120 ~ 179 days, randomized }
- …
In our document, we have a field called publishDate, which has fieldType of “date”. I was thinking if I can use sort function do this (just some psudo-code):
sort=((Today - publishDate) / 60 ) asc, rand_## desc, score desc
Also, if it doable, is this only supported in current SOLR version? 3.x or 4?
Thanks in advance.
This should be doable as you mentioned above with Function Queries and RandomSort field and is support for both 3.x and 4.0
You can check for sub, div, ms functions to perform the subtraction, division and millseconds to reach to the date range value and have it sorted.
Use the RandomSort fields as a secondary sort to randomized it.