开发者

How to constrain/filter More Like This results in Solr?

In Solr, I am wondering if it's possible to constrain/filter the "More Like This" result set from a standard (dismax) query - e.g., without having to use the specific MoreLikeThis request handler? For example, 开发者_StackOverflowI have a Solr index which has documents for two countries. When I do my original (dismax) query, I use a field query operator (fq) to filter the results for the country of interest. But the MLT results that get returned are for both countries. I tried using the mlt.fl=country,name to indicate "show me more results that are similar in country and name" but it doesn't seem to obey the country criteria (or at least the name parameter far outweighs the country parameter).

I can't seem to find any Solr documentation that indicates there is an option for this, but I'm hoping one of you Solr experts out there may have some nifty tricks/hacks for this.

Thanks in advance!


Solr mlt.fl is supposed to find Related Documents based on these fields. However, it is not obligated to do so like the NOT clause of fq. A workaround could be to exclude the country using fq param. So, your mlt query could become something like

/mlt?q=id:ID&fq=-country:COUNTRY&mlt.boost=true

ID: The document ID for which MLT needs to be calculated. COUNTRY: The country which you want to exclude.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜