Question

I want to have a long listing of items in Solr with a very specific order. I have no experience with Solr facets: are they a good way to group results in a date-range where inside the range I can boost various items a bit?

Ordering principle

  1. All items must be generally in chronological order
  2. This order must be strict per specific range
  3. Within such range items might get a little bit more priority
  4. Within this range items might have a super high priority
  5. In the complete list, some items might be outside their range and stick to the top

Example configuration

So if I have a table of items, it might look like this:

  1. Sticky items are 100% on top
  2. Events have a higher prio than blogs
  3. Featured are always at the top within a range
  4. A range is set to a week (7 days)

This might look like this (example 1):

sticky   | 2012-11-01
blog 2   | 2012-12-02
blog 1   | 2012-12-01

Or (example 2, the dashed lines are just to indicate the week barrier):

blog 5   | 2012-11-26
---------------------
featured | 2012-11-19   <<< featured are at the top in week 19-25 Nov
blog 4   | 2012-11-23
blog 3   | 2012-11-22
blog 2   | 2012-11-21
blog 1   | 2012-11-19
---------------------
featured | 2012-11-12

Or (example 3):

event    | 2012-11-28   <<< events have a bit more prio in week 26 Nov - 2 Dec
blog 5   | 2012-11-29
blog 5   | 2012-11-28
blog 5   | 2012-11-26
---------------------
event    | 2012-11-20   <<< events have a bit more prio in week 19-25 Nov
blog 4   | 2012-11-23
blog 3   | 2012-11-22
event    | 2012-11-19   <<< events have a bit more prio in week 19-25 Nov
blog 2   | 2012-11-21
blog 1   | 2012-11-19
---------------------
blog     | 2012-11-18

(to clarify, the amount of priority for events (1 or 2 days or x% is just something for fine tuning, it's not part of my problem at this moment)

QUESTION

Now the question: I know I can boost items per field or per field-value, for a certain amount or a high value to push it to the top. But I must restrict this to a certain range (in the examples, 7 days). A featured can never get out of the scope of a week, just like the events.

I have heard about facets, but am not sure if this can solve my problem. Since I am a layman with solr, it's hard to figure out if I can achieve this. I have looked at the solr wiki, but all the new terminology clutter a bit my search towards this idea.

I might solve this by using "pagination" as date range (so search from:[date] to:[date]) and therefore create a "facet" myself. Is that easier? As you see, I have no idea with regard to facets and complex solr queries :)

No correct solution

OTHER TIPS

One thing you could do is use the grouping feature. You store the week of the year (GregorianCalendar WEEK_OF_YEAR) in a new index field and you group your results by this. Inside of the group there is the normal relevance computation that you define.

Here is a link with examples: http://wiki.apache.org/solr/FieldCollapsing

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top