Exception writing document id to the index; possible analysis error

匆匆过客 提交于 2019-12-01 05:17:00

问题


I am getting the above error while indexing the documents.

<field name="a_suggest" type="my_suggest_field" indexed="true" stored="false"/>
<field name="b_suggest" type="my_suggest_field" indexed="true" stored="false" />
<field name="c_suggest" type="my_suggest_field" indexed="true" stored="false"/>

  <fieldType name="my_suggest_field" class="solr.TextField" positionIncrementGap="100">
    <analyzer type="index">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory" />
        <filter class="solr.EdgeNGramFilterFactory" maxGramSize="10" minGramSize="2"/>
    </analyzer>
    <analyzer type="query">
        <tokenizer class="solr.StandardTokenizerFactory" />
        <filter class="solr.LowerCaseFilterFactory" />
    </analyzer>
  </fieldType>

And I am getting error when calling..

server.add(documents);

First of all, what is the meaning of Possible analysis error? Is it related to my_suggest_field index analyzer. Is it due to the order of the tokens, filters in the index analyzer?

Thanks.


回答1:


I am going to piggy back off this question because it is one of the first ones that comes up when looking for this issue and there are no general answers.

I was getting the same problem when trying to use the update API to add a document using a json. Come to find out one of my fields in solr was not formatted correctly as I was trying to save an XML string into a string field. I had to change the field to text_general.

The error is basically saying that what you are entering might not fit with your schema. Check each of your fields by adding them to the update 1 at a time. Then change as necessary.




回答2:


I need to create a separate field types for EdgeNGramFilterFactory and normal suggest.

  <field name="my_suggest" type="my_suggest_field" indexed="true" stored="false"/>
  <field name="my_suggest_ngram" type="my_suggest_ngram_field" indexed="true" stored="false"/>

  <fieldType name="my_suggest_field" class="solr.TextField" positionIncrementGap="100">
    <analyzer type="index">
        <filter class="solr.LowerCaseFilterFactory" />
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    </analyzer>
    <analyzer type="query">
        <tokenizer class="solr.StandardTokenizerFactory" />
        <filter class="solr.LowerCaseFilterFactory" />
    </analyzer>
  </fieldType>

  <fieldType name="my_suggest_ngram_field" class="solr.TextField" positionIncrementGap="100">
        <analyzer type="index">
            <filter class="solr.LowerCaseFilterFactory" />
            <tokenizer class="solr.WhitespaceTokenizerFactory"/>
            <filter class="solr.EdgeNGramFilterFactory" minGramSize="2" maxGramSize="10"/>
        </analyzer>
        <analyzer type="query">
            <tokenizer class="solr.StandardTokenizerFactory" />
            <filter class="solr.LowerCaseFilterFactory" />
        </analyzer>
  </fieldType>


来源:https://stackoverflow.com/questions/26531404/exception-writing-document-id-to-the-index-possible-analysis-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!