1
votes

I'am able to perform more like this. I have set of documents returned as more like given document. How to provide different boost for different match fields in more like this? Say i do more like this based on fields title and description of products. I wanna provide more boost for match field title than the description.

Query im trying so far is

mysolrhost:8983/solr/mlt?q=id:UTF8TEST&mlt.fl=title,description&mlt.mindf=1&mlt.mintf=1

Is there any way to provide different boost for title and description?

1

1 Answers

1
votes

According to the docs (https://cwiki.apache.org/confluence/display/solr/MoreLikeThis) you can use the mlt.fl parameter, which supposedly mirrors the Edismax qf parameter in that it allows you to specify different boosts per field. However, when I tried it, I was unable to get it to alter the results returned, even when dropping fields or setting very high or low boosts: (Solr MoreLikeThis boosting query fields).

I would recommend just writing your own code to transform a document into a solr query, picking the top terms by tfidf from each field, and then setting query time boosts. If you do this, make sure you perform length normalization on each field to ensure the length of the resulting query vector reflects the total boost you desire for that field. This can be achieved by dividing the field level boost by the the L2 norm, treating the all terms for a single field as a single vector, thus distributing the total boost per field across all terms in the query. This is only important if you use a different number of terms per field, if you use the same number you don't need to do this.