从solr 4升级到solr 7后,查询不再起作用(edismax中的“应该发生”还是“必须发生”)

时间:2018-08-01 14:42:44

标签: solr

我有一个如下查询: http://localhost:8984/solr/UT990001/select?defType=edismax&q=Red+Blue+%2BBlack+-White&qf=cfs_U3RyaW5nQ0Y_3

我的期望是,仅当字段cfs_U3RyaW5nQ0Y_3包含“ Black”而不包含White时,查询才会返回。如果存在红色和蓝色值,则它们在搜索结果中的位置会更高。

这不再适用于我的Solr 7配置。 我有2个设置(Solr 4和Solr 7),每个都有相同的数据。 当我在Solr 4中运行上述查询时,它可以按预期运行,但是在Solr 7中,返回零结果。

这是我为数据准备的种子的一个概念,值= cfs_U3RyaW5nQ0Y_3的值

  • Doc1 =红色
  • Doc2 =红色
  • Doc3 =黑色
  • Doc4 =黑色
  • Doc5 =白色
  • Doc6 =蓝色
  • Doc7 =红色黑色白色蓝色
  • Doc8 =背面和白色

结果:

  • Solr4:2次匹配,Doc3和Doc4
  • Solr7:0次点击

任何对从何处开始寻找见解的赞赏。

我们为字段加别名(用户不是搜索cfs_U3RyaW5nQ0Y_3,而是搜索color(为了简化起见,我将搜索的URL简化了)

字段cfs_U3RyaW5nQ0Y_3的类型定义为:

<fieldType name="text_auto" class="solr.TextField" positionIncrementGap="100">
    <analyzer>
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1" preserveOriginal="1" />
        <filter class="solr.LowerCaseFilterFactory"/>
    </analyzer>
</fieldType>

模式:

<?xml version="1.0" encoding="UTF-8" ?>
<schema name="example" version="1.5" EclipseRevision="38447">
  <types>
    <fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
    <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/>
    <fieldType name="int" class="solr.IntPointField" omitNorms="true" positionIncrementGap="0"/>
    <fieldType name="long" class="solr.LongPointField" omitNorms="true" positionIncrementGap="0"/>
    <fieldType name="double" class="solr.DoublePointField" omitNorms="true" />
    <fieldType name="tdouble" class="solr.DoublePointField" omitNorms="true" />
    <fieldType name="tdate" class="solr.DatePointField" omitNorms="true" positionIncrementGap="0"/>
    <fieldType name="text_auto" class="solr.TextField" positionIncrementGap="100">
      <analyzer>
        <tokenizer class="solr.WhitespaceTokenizerFactory" />
        <filter class="solr.WordDelimiterGraphFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1" preserveOriginal="1" />
        <filter class="solr.LowerCaseFilterFactory" />
      </analyzer>
    </fieldType>
    <fieldType name="string_sorted" class="solr.TextField" sortMissingLast="true" omitNorms="true">
        <analyzer>
            <tokenizer class="solr.KeywordTokenizerFactory"/>           
            <filter class="solr.LowerCaseFilterFactory" />
        </analyzer>
    </fieldType>    
  </types>
  <fields>
    <field name="id" type="string" indexed="true" stored="true" required="true" />
    <field name="type" type="int" indexed="true" stored="true" required="true" />
    <field name="title" type="text_auto" indexed="true" stored="true" />
    <field name="keywords" type="text_auto" indexed="true" stored="true"/>
    <field name="created" type="tdate" indexed="true" stored="true" />
    <field name="modified" type="tdate" indexed="true" stored="true"/>
    <field name="securityclassid" type="string" indexed="true" stored="true" />
    <field name="contenttypeid" type="string" indexed="true" stored="true" />
    <field name="extension" type="string" indexed="true" stored="true" />
    <field name="_version_" type="long" indexed="true"  stored="true"/>
    <field name="nonindexedmeta" type="string" indexed="false" stored="true" />
    <!--Dumping ground for items we want included in search results but do not want search hits on; see NonIndexedMeta class -->
    <dynamicField name="cfi_*" type="int" indexed="true" stored="true" multiValued="true"/>
    <dynamicField name="cfs_*"  type="text_auto"  indexed="true"  stored="true" multiValued="true"/>
    <!-- Do not make cfg_* into a text_auto -->
    <dynamicField name="cfg_*"  type="string"  indexed="true"  stored="true" multiValued="true"/>
    <dynamicField name="cfl_*"  type="long"   indexed="true"  stored="true" multiValued="true"/>
    <dynamicField name="cfb_*"  type="boolean" indexed="true"  stored="true" multiValued="true"/>
    <dynamicField name="cfbd_*"  type="double"  indexed="false"  stored="true" multiValued="true"/>
    <dynamicField name="cfdt_*"  type="tdate"  indexed="true"  stored="true" multiValued="true"/>
      <dynamicField name="cfdo_*"  type="tdate"  indexed="true"  stored="true" multiValued="true"/>
      <dynamicField name="qcfbd_*"  type="tdouble"  indexed="true"  stored="false"/>
    <!-- The following are used for sorting only. -->
    <!-- Do not make any sorted field text_auto #13895 -->
    <field name="title_sort" type="string_sorted" indexed="true" stored="false" />
    <field name="keywords_sort" type="string_sorted" indexed="true" stored="false"/>
    <dynamicField name="scfi_*" type="int" indexed="true" stored="false"/>
    <dynamicField name="scfs_*"  type="string_sorted"  indexed="true"  stored="false" />
    <dynamicField name="scfg_*"  type="string_sorted"  indexed="true"  stored="false"/>
    <dynamicField name="scfl_*"  type="long"   indexed="true"  stored="false" />
    <dynamicField name="scfb_*"  type="boolean" indexed="true"  stored="false" />
    <dynamicField name="scfbd_*"  type="double"  indexed="true"  stored="false" />
    <dynamicField name="scfdt_*"  type="tdate"  indexed="true"  stored="false" />
    <dynamicField name="scfdo_*"  type="tdate"  indexed="true"  stored="false" />
    <!-- This field is used to build the spellchecker index -->
    <field name="typeahead" type="text_auto" indexed="true" stored="false" multiValued="true"/>
  </fields>
  <copyField source="title" dest="title_sort"/>
  <copyField source="keywords" dest="keywords_sort"/>
  <copyField source="title" dest="typeahead"/>
  <copyField source="keywords" dest="typeahead"/>
  <copyField source="cfi_*" dest="typeahead"/>
  <copyField source="cfs_*" dest="typeahead"/>
  <copyField source="cfl_*" dest="typeahead"/>
  <copyField source="cfb_*" dest="typeahead"/>
  <copyField source="cfbd_*" dest="typeahead"/>
  <copyField source="cfdt_*" dest="typeahead"/>
  <copyField source="cfdo_*" dest="typeahead"/>
  <copyField source="scfbd_*" dest="qcfbd_*"/>
  <uniqueKey>id</uniqueKey>
</schema>

0 个答案:

没有答案