基于 Solr 规则的提升 [英] Solr rule based boost

查看:24
本文介绍了基于 Solr 规则的提升的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Solr-5.0.0.我正在搜索字段 product_name.我需要添加一些规则才能获得相关结果.

I am using Solr-5.0.0. I am searching on a field product_name. I need to add some rules to get relevant results.

  1. 如果我搜索一个词,如果存在完全匹配,它应该排在第一位.例如:如果我搜索 laptop ,它应该首先返回与 laptop 完全相同的 product_name.

  1. If I search for a word, if exact match exists , it should come first. Ex: if I search for laptop ,it should return exact product_name with laptop first.

如果我搜索多个单词,它应该遵守规则 1.随着最小单词长度,距离名称排在第一位.例如:如果我搜索dell notebook,它应该首先返回Dell notebook,而不是dell inspiron notebook.

If I search for more than one word , it should obey rule 1. along with least word length distanced names come first. Ex: if I search dell laptop, it should return Dell laptop first than dell inspiron laptop.

如果我搜索单词,它不应该返回包含 withwithout 单词的结果.例如:在搜索laptop bag 时,不应该先给出dell notebook with bagdell notebook without bag 的结果.

If I search for words it should not return results contains with or without words. Ex: in search laptop bag , it should not give dell laptop with bag or dell laptop without bag results first.

如何在查询时实现这些基于规则的搜索相关结果?

How can I achieve these rules based search relevant results at query time?

我的应用程序是在 Java 中,所以 Java 的回答是值得赞赏的.

My application is in java, so Java answer is appreciated.

推荐答案

首先,您应该使用 dismaxedismax 查询解析器而不是默认的 (lucene).

To begin with, you should use the dismax or edismax query parser instead of the default (lucene).

然后你可以使用不同的参数来提高相关性:

Then you can improve relevancy using different parameters :

  1. :使用 qf 以提升您的 product_name 字段.
  2. :使用 pf 提升您的 product_name 字段,其中 q 参数中的所有术语都出现在附近.
  3. :使用 bq 来提升没有出现 withwithout 字样的文档.参见此处.例如:bq=(*:* -with -without)^999
  1. : Use qf to boost your product_name field.
  2. : Use pf to boost your product_name field where all of the terms in the q parameter appear in close proximity.
  3. : Use bq to boost documents where the words with or without don't appear. See here. For example : bq=(*:* -with -without)^999

这篇关于基于 Solr 规则的提升的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆