0

We are using Solr 1.4 to produce results for user queries. The results are fetched from an index containing approximately 500k documents. The index is constantly being updated with new documents and old documents expire.

The results pages are lists of documents sorted by relevancy (score), automatically calculated by solr depending on the user's query. Each document belongs to a single category (e.g engineering, finance, administration, maths etc) and the category id is stored and indexed by Solr.

What we want to achieve is for documents to be sorted on relevancy, but also be weighted in some way so that at least the first page of results (10,20 or 50) contains documents from as many categories as possible and as few documents of the same category are consecutive.

We've searched a lot but have not managed to come up with any feasible scenario.

Many thanks in advance for any ideas. GK

1 Answers1

1

To the best of my knowledge, this isn't possible in Solr. I mean, what if the search term is much more applicable to engineering items than anything else, you would need to artificially boost the other categories in different ways based on the search result.

You can do something similar to this in the latest version using field collapsing. I.e. you will only get an X number of hits from a category and then a link to 'show more like this'.

Alternatively, you could do several searches, one for each category and 'blend them' yourself.

Kris
  • 14,426
  • 7
  • 55
  • 65