不能在solr 7.5中使用Edge NGram

时间:2019-06-17 21:12:12

标签: solr

我正在使用solr 7.5,但我尝试使用Edge NGram,但出现错误。

collection: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Could not load conf for core collection: 
Can't load schema /Users/srinivaskallepalli/aem/integration-test/target/solr-7.5.0/server/solr/wnt-test_master_Products_de/conf/schema.xml: Plugin init failure for [schema.xml] fieldType "text_general_EDGE_NGRAM": Plugin init failure for [schema.xml] analyzer/filter: Error instantiating class: org.apache.lucene.analysis.ngram.EdgeNGramFilterFactory'

请检查您的日志以获取更多信息

下面是边缘NGram的架构

<fieldType name="text_general_EDGE_NGRAM" class="solr.TextField" positionIncrementGap="100">
            <analyzer type="index">
                <tokenizer class="solr.StandardTokenizerFactory" />
                <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords_de.txt" />
                <filter class="solr.LowerCaseFilterFactory" />
                <filter class="solr.GermanLightStemFilterFactory"/>
                <filter class="solr.EdgeNGramFilterFactory" minGramSize="3" maxGramSize="30" side="front"/>

            </analyzer>
            <analyzer type="query">
                <tokenizer class="solr.StandardTokenizerFactory" />
                <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords_de.txt" />
                <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true" />
                <filter class="solr.LowerCaseFilterFactory" />
                <filter class="solr.GermanLightStemFilterFactory"/>

            </analyzer>
        </fieldType>

        <fieldType name="text_general_EDGE_END_NGRAM" class="solr.TextField" positionIncrementGap="100">
            <analyzer type="index">
                <tokenizer class="solr.StandardTokenizerFactory" />
                <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords_de.txt" />
                <filter class="solr.LowerCaseFilterFactory" />
                <filter class="solr.GermanLightStemFilterFactory"/>
                <filter class="solr.EdgeNGramFilterFactory" minGramSize="3" maxGramSize="30" side="back"/>
                <filter class="solr.ReverseStringFilterFactory"/>

            </analyzer>
            <analyzer type="query">
                <tokenizer class="solr.StandardTokenizerFactory" />
                <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords_de.txt" />
                <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true" />
                <filter class="solr.LowerCaseFilterFactory" />
                <filter class="solr.GermanLightStemFilterFactory"/>

            </analyzer>
        </fieldType>

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:1)

您需要删除属性side="back"side="front"。 从架构文件中删除side="front", side="back"会删除该错误。

使用以下字段类型。

<fieldType name="text_general_EDGE_NGRAM" class="solr.TextField" positionIncrementGap="100">
     <analyzer type="index">
       <tokenizer class="solr.StandardTokenizerFactory" />
          <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords_de.txt" />
          <filter class="solr.LowerCaseFilterFactory" />
          <filter class="solr.GermanLightStemFilterFactory"/>
          <filter class="solr.EdgeNGramFilterFactory" minGramSize="3" maxGramSize="30"/>
     </analyzer>
     <analyzer type="query">
       <tokenizer class="solr.StandardTokenizerFactory" />
          <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords_de.txt" />
          <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true" />
          <filter class="solr.LowerCaseFilterFactory" />
          <filter class="solr.GermanLightStemFilterFactory"/>
      </analyzer>
   </fieldType>

Please refer the link

我建议查询类型分析器应如下所示,但这又取决于您的要求。

<analyzer type="query">
   <tokenizer class="solr.LowerCaseTokenizerFactory"/>
</analyzer>