3

在 Solr-5.0.0 中,我有一个product_name字段。当我搜索一个词或多个词时,它会给出包含这些词的产品名称的结果。我怎样才能做到这一点,因为完全匹配是第一位的。

我的Schema.xml如下:

<field name="product_name" type="text_wslc" indexed="true" stored="true" required="true" multiValued="false"/>

我的字段定义也在下面给出:

<fieldType name="text_wslc" class="solr.TextField" positionIncrementGap="100">
  <analyzer type="index">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
    <filter class="solr.WordDelimiterFilterFactory"
                             generateWordParts="1"
                             generateNumberParts="1"
                             catenateWords="1"
                             catenateNumbers="1"
                             catenateAll="1"
                             preserveOriginal="1"
                             />
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.SnowballPorterFilterFactory" language="English" />
    <filter class="solr.PorterStemFilterFactory"/>
    <filter class="solr.KStemFilterFactory"/>
    <filter class="solr.EnglishMinimalStemFilterFactory"/>
  </analyzer>
  <analyzer type="query">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.WordDelimiterFilterFactory"
                             generateWordParts="1"
                             generateNumberParts="1"
                             catenateWords="1"
                             catenateNumbers="1"
                             catenateAll="1"
                             preserveOriginal="1"
                             />
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.SnowballPorterFilterFactory" language="English" />
    <filter class="solr.PorterStemFilterFactory"/>
    <filter class="solr.KStemFilterFactory"/>
    <filter class="solr.EnglishMinimalStemFilterFactory"/>
  </analyzer>
</fieldType>

在索引时间或查询时间需要任何提升吗?还是别的什么?

4

0 回答 0