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

查看:101
本文介绍了基于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 product_name em> first。

  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 laptop ,它应该首先返回戴尔笔记本电脑而不是 dell inspiron laptop

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.

如果我搜索单词,则不应返回包含的结果没有字样。
Ex:在搜索笔记本电脑包中,它不应该给 dell笔记本电脑包带戴尔笔记本电脑没有包结果第一。

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.

推荐答案

首先,您应该使用 dismax edismax 查询解析器而不是默认值( 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 来提升单词没有不会出现。 请参阅此处。例如: 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天全站免登陆