简体   繁体   English

Solr 6.5.1的搜索顺序为第一个完全匹配,第二个从左到右匹配

[英]Solr 6.5.1 search in order first full match second left to right match

I am using lucene for indexing and solr for searching and having below requirements 我正在使用lucene进行索引编制并且使用solr进行搜索并且具有以下要求

example: “Test Five” 示例:“测试五”

  1. Highest priority - Words having both “Test” and “Five” 最高优先级-同时具有“测试”和“五个”的词
  2. Next - Words having only left most word “Test” 下一步-仅剩单词“ Test”的单词
  3. Next – Next word in the list –“Five” (left to right) etc etc 下一个–列表中的下一个单词–“五个”(从左到右)等

Please find my schema 请找到我的架构

<field name="name" type="text_general" indexed="true" stored="true"/>
<field name="acSearch" type="searchFieldType" required="false" indexed="true" stored="false" multiValued="true" />
<copyField source="name" dest="acSearch" />
<fieldType name="searchFieldType" class="solr.TextField" positionIncrementGap="100">
        <analyzer type="index">
            <tokenizer class="solr.PatternTokenizerFactory" pattern="[,]+" />
            <filter class="solr.LowerCaseFilterFactory" />
            <filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="25" />
        </analyzer>
        <analyzer type="query">
            <tokenizer class="solr.PatternTokenizerFactory" pattern="[,]+" />
            <filter class="solr.LowerCaseFilterFactory" />

        </analyzer></fieldType>

solrconfig.xml solrconfig.xml中

 <requestHandler name="/select" class="solr.SearchHandler">
 <lst name="defaults">
  <str name="wt">json</str>
  <str name="indent">true</str>
  <str name="fl">name</str>
  <str name="rows">200</str>
  <str name="df">dySearch</str>
  <str name="sort">score desc</str>
</lst>
<arr name="components">
  <str>query</str>
</arr>

I am not getting proper out put if i search 如果我搜索,我的出场时间不正确

1.Test Five in response Test Five is coming first next not from left to right in any order data is coming 1.测试五的响应测试五是第一位的,其次是从左至右,而不是任何顺序的数据

  1. If i search Five Test related data is coming first . 如果我搜索“五项测试”相关数据,那么将是第一位。

Please could you help .... 请您帮忙....

you can just give a different boost to each of the terms when you build your query string: 您可以在构建查询字符串时对每个术语进行不同的提升:

 q=Test^10 Five^3 last^1

With this, you don't need to mess with ngram etc, use just some standard analyzer 这样,您就无需弄乱ngram等,只需使用一些标准分析器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM