"2d Search" in Solr or how to get the best item of the multivalued field 'items'?

Posted by Karussell on Stack Overflow See other posts from Stack Overflow or by Karussell
Published on 2010-06-07T11:58:16Z Indexed on 2010/06/07 12:02 UTC
Read the original article Hit count: 194

Filed under:
|
|

The title is a bit awkward but I couldn't found a better one. My problem is as follows:

I have several users stored as documents and I am storing several key-value-pairs or items (which have an id) for each document. Now, if I apply highlighting I can get the first n items. If you have several hundreds of such items this highlighting is necessary and works nicely. But there are two problems:

  1. The highlighted text won't contain the id and so retrieving additional information of the highlighted item text is ugly. E.g. you need to store the id in the text so that the highlighter returns it. Adding the id to the hl.fl parameter does not help.
  2. You will not get the most relevant n-items. You will get the first n items ...

So how can I find the best items of a documents with multiple such items?

I will now add my own findings as answers, but as I will point out. Each of them has its drawbacks. Hopefully anyone of you can point me to a better solution.

© Stack Overflow or respective owner

Related posts about solr

Related posts about highlighting