2016-05-06 7 views
3

LUCENE-5472では、単にメッセージを記録するのではなく、用語が長すぎる場合、Luceneがエラーをスローするように変更されました。このエラーは、SOLRは、この問題を解決しようとすると、32766SOLRには「文書には少なくとも1つの膨大な用語が含まれています」

Caused by: java.lang.IllegalArgumentException: Document contains at least one immense term in field="text" (whose UTF8 encoding is longer than the max length 32766), all of which were skipped. Please correct the analyzer to not produce such terms. The prefix of the first immense term is: '[10, 10, 70, 111, 117, 110, 100, 32, 116, 104, 105, 115, 32, 111, 110, 32, 116, 104, 101, 32, 119, 101, 98, 32, 104, 111, 112, 101, 32, 116]...', original message: bytes can be at most 32766 in length; got 43225 
    at org.apache.lucene.index.DefaultIndexingChain$PerField.invert(DefaultIndexingChain.java:671) 
    at org.apache.lucene.index.DefaultIndexingChain.processField(DefaultIndexingChain.java:344) 
    at org.apache.lucene.index.DefaultIndexingChain.processDocument(DefaultIndexingChain.java:300) 
    at org.apache.lucene.index.DocumentsWriterPerThread.updateDocument(DocumentsWriterPerThread.java:234) 
    at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:450) 
    at org.apache.lucene.index.IndexWriter.updateDocument(IndexWriter.java:1475) 
    at org.apache.solr.update.DirectUpdateHandler2.addDoc0(DirectUpdateHandler2.java:239) 
    at org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:163) 
    ... 54 more 
Caused by: org.apache.lucene.util.BytesRefHash$MaxBytesLengthExceededException: bytes can be at most 32766 in length; got 43225 
    at org.apache.lucene.util.BytesRefHash.add(BytesRefHash.java:284) 

よりトークン大きな受け入れないと述べて、私は(太字中)スキーマ内の2つのフィルタを追加しました:エラー以来

<field name="text" type="text_en_splitting" termPositions="true" termOffsets="true" termVectors="true" indexed="true" required="false" stored="true"/> 
<fieldType name="text_en_splitting" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true"> 
<fieldType name="text_en_splitting" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true"> 
     <analyzer type="index"> 
     <tokenizer class="solr.WhitespaceTokenizerFactory"/> 
     <!-- in this example, we will only use synonyms at query time 
     <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/> 
     --> 
     <!-- Case insensitive stop word removal. 
     --> 
     <filter class="solr.StopFilterFactory" 
       ignoreCase="true" 
       words="lang/stopwords_en.txt" 
      /> 
     <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/> 
     <filter class="solr.LowerCaseFilterFactory"/> 
     <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/> 
     <filter class="solr.PorterStemFilterFactory"/> 
**<filter class="solr.TruncateTokenFilterFactory" prefixLength="32700"/> 
<filter class="solr.LengthFilterFactory" min="2" max="32700" />** 
</analyzer> 
</fieldType> 

を(フィルタが正しく設定されていないと思われますか?) Bashettiさんのおかげでサーバを再起動することが鍵

質問はどちらが良いですか:LengthFilterFactoryまたはTruncateTokenFilterFactory?そして、バイトが文字であると仮定しているのは正しいですか?(フィルターは '珍しい'文字を削除する必要がありますか?) ありがとうございました!

+0

。 –

+0

SOLRで許可されている最大数を超えて無視または切り捨てたい(または何でも)必要がある – salvob

+1

変更後にsolrサーバーを再起動しましたか? –

答えて

1

エラーが"SOLR doesn't accept token larger than 32766"

問題はあなたのためだったが、あなたのフィールドのテキストとあなたがSolrのを再起動していないので、あなたがフィールドタイプを変更した後、現在取得しているその同じ問題のために、以前の文字列FIELDTYPEを使用していると言います変更後のサーバー。

TruncateTokenFilterFactoryまたはLengthFilterFactoryを追加する必要はありません。

しかし、それはあなたとあなたのwhats要件が残されています。

+0

まあ、私はフィルタを追加する前に同じ問題があった、私はそれを修正しようとしました.. プラス[doc](https://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.LengthFilterFactory)には、 "これらのトークンをフィルタリングしません*長さが最小から最大までを含む" これは、 32700を超える値を捨てるべきです。そうですか? – salvob

+0

変更前にテキストフィールドにstring fieldTypeを使用しましたか? –

+1

サーバを再起動してデータを再インデックスしよう... –

0

ビン/ポストツールを使用してSolr-6.0.0へ(http://jsonstudio.com/wp-content/uploads/2014/02/enron.zip)から

以下

参照の抜粋をenron_emailデータをロードしている間、私は同じエラーを持っていた...少なくとも一つの巨大な含まれていフィールドのterm = \ "text \"(そのUTF8 エンコーディングが最大長32766よりも長い)です(すべて をスキップしました)。このような用語を生成しないようにアナライザーを修正してください。第1の莫大な用語の接頭語「 」は、「[78,97,110,99,121,32,83, 104,101,101,100,32,60,110,97,110,99,121,95 、115、104、101、 101,100,64,66,85,83,73,78 ... '、元のメッセージ:バイトは 、長さは最大で32766です。 43172.を得たおそらく文書がインデックス化 文字列フィールドが大きすぎる(solr.StrField)を持っている」、 "コード":400}} SimplePostTool:WARNING:IOExceptionが応答を読みながら: にjava.io.IOException:Serverが返されるHTTP応答コード:URLの400: http://localhost:8983/solr/enron_emails/update/json/docs ...

RCA スキーマのフィールド名 "テキスト" FIELDTYPE文字列を使用して32766に制限されています。 は32766以上の長さを持つデータ/ CLOBのを受け入れるためには、フィールドタイプが

ソリューションスタンドアロンモードで

A)

編集ファイル$ SOLR_HOME /サーバー/ text_generalように変更する必要がありましたSolrの/ core_name/confに/管理スキーマ、
私は<field name="text" type="text_general"/>

<field name="text" type="strings"/>を変更あなたはそのがこれらのトークンは、* *最大包括を通じて長さ分を持っていないフィルタに出かけるようLengthFilterFactoryを持っていない理由

B)Solrcloudモード(マネージド・スキーマファイルが埋め込まれているか自分の飼育係になりますよう)

# check collections field "text" definition 
curl "http://localhost:8983/solr/enron_emails/schema/fields/text?wt=json&indent=true" 

# Modify collections field "text" definition 
curl -X POST -H 'Content-type:application/json' --data-binary '{ 
    "replace-field":{ 
    "name":"text", 
    "type":"text_general", 
    "stored":false } }' "http://localhost:8983/solr/enron_emails/schema?wt=json&indent=true" 

# Verify collections field "text" new definition 
curl "http://localhost:8983/solr/enron_emails/schema/fields/text?wt=json&indent=true" 
関連する問題