2017-04-07 23 views
1

私はSolr 6.5.0を使用していますが、ドキュメントの複数の言語のデータフィールドにインデックスを付ける必要があります。SolrがURLの#400(Bad Request)エラーを返しました

言語ごとに別のフィールドを使用しようとしています。特定の言語のデータを、その言語用に定義された対応するフィールドにインデックスする必要があります。

私は設定して、スキーマの変更の下に追加しました:

のSolrの設定:

<requestHandler name="/update" class="solr.UpdateRequestHandler"> 
     <lst name="defaults"> 
     <str name="update.chain">langid</str> 
     </lst>  
    </requestHandler> 
    <updateRequestProcessorChain name="langid"> 
     <processor class="org.apache.solr.update.processor.TikaLanguageIdentifierUpdateProcessorFactory"> 
      <str name="langid.fl">title</str> 
      <str name="langid.langField">lang</str> 
      <str name="langid.fallback">en</str> 
     </processor> 
     <processor class="solr.LogUpdateProcessorFactory" /> 
     <processor class="solr.RunUpdateProcessorFactory" /> 
     </updateRequestProcessorChain> 

スキーマ:

<field name="code" type="string" indexed="true" stored="true"/> 
    <field name="title" type="string" indexed="true" stored="true"/> 
    <field name="content_english" type="text_english" indexed="true" stored="true"/> 
    <field name="content_french" type="text_french" indexed="true" stored="true"/> 
    <field name="content_spanish" type="text_spanish" indexed="true" stored="true"/> 

入力のxml:

<add> 
<doc> 
    <field name="code">one</field> 
    <field name="title">Adventures</field> 
    <field name="content_english">Especially the fuzzy search is very welcome; Solr really is a beautiful engine and it’s incredibly fast: millions of documents are no problem. Of course, if your servers capacities are configured correctly.</field>  
</doc> 
<doc> 
    <field name="code">two</field> 
    <field name="title">Aventures</field> 
    <field name="content_french">Surtout la recherche floue est très bienvenue; Solr est vraiment un beau moteur et c'est incroyablement rapide: des millions de documents ne posent aucun problème. Bien sûr, si les capacités de vos serveurs sont configurées correctement.</field>  
</doc> 
<doc> 
    <field name="code">three</field> 
    <field name="title">Aventuras</field> 
    <field name="content_spanish">Especialmente la búsqueda difusa es muy bienvenida; Solr realmente es un motor hermoso y es increíblemente rápido: millones de documentos no son ningún problema. Por supuesto, si las capacidades de los servidores están configuradas correctamente.</field>  
</doc> 
</add> 
たび私は、コア、I'amは以下のエラーを取得して更新します。

C:\solr-6.5.0\example\exampledocs>java 
-Durl=http://localhost:8983/solr/autodetect/update?update.chain=langid -jar post.jar multilanguage.xml SimplePostTool version 5.0.0 

Posting files to [base] url http://localhost:8983/solr/autodetect/update?update.chain=langid using content-type application/xml... POSTing file multilanguage.xml to [base] SimplePostTool: WARNING: Solr returned an error #400 (Bad Request) for url: http://localhost:8983/solr/autodetect/update?update.chain=langid SimplePostTool: WARNING: Response: 4006org.apache.solr.common.SolrExceptionorg.apache.solr.common.SolrExceptionDocument is missing mandatory uniqueKey field: id400 SimplePostTool: WARNING: IOException while reading response: java.io.IOException: Server returned HTTP response code: 400 for URL: http://localhost:8983/solr/autodetect/update?update.chain=langid 1 files indexed. COMMITting Solr index changes to http://localhost:8983/solr/autodetect/update?update.chain=langid ... Time spent: 0:00:00.179

答えて

0

さてあなたはエラーを見てきましたが?あなたのドキュメントには、 'id'という必須フィールドの値がありません。

<add> 
<doc> 
    <field name="code">one</field> 
    <field name="id">1</field> 
    <field name="title">Adventures</field> 
    <field name="content_english">Especially the fuzzy search is very welcome; Solr really is a beautiful engine and it’s incredibly fast: millions of documents are no problem. Of course, if your servers capacities are configured correctly.</field>  
</doc> 
<doc> 
    <field name="code">two</field> 
    <field name="id">2</field> 
    <field name="title">Aventures</field> 
    <field name="content_french">Surtout la recherche floue est très bienvenue; Solr est vraiment un beau moteur et c'est incroyablement rapide: des millions de documents ne posent aucun problème. Bien sûr, si les capacités de vos serveurs sont configurées correctement.</field>  
</doc> 
<doc> 
    <field name="code">three</field> 
    <field name="id">3</field> 
    <field name="title">Aventuras</field> 
    <field name="content_spanish">Especialmente la búsqueda difusa es muy bienvenida; Solr realmente es un motor hermoso y es increíblemente rápido: millones de documentos no son ningún problema. Por supuesto, si las capacidades de los servidores están configuradas correctamente.</field>  
</doc> 
</add> 

また、存在しない場合は、自動的に値を割り当てるようにSolrを設定することもできます。

1

エラー:ドキュメントにIDフィールドがありません。

id各文書を一意に識別するために使用される文書は、以下のようなスキーマファイルで指定されます。

<uniqueKey>id</uniqueKey> 

すべてのドキュメントには、一意のキーとして指定されたフィールドが必要です。

あなたのすべてのドキュメントとチェックのためのInclude Idフィールド。 例:

<doc> 
    <field name="id">001</field> 
    <field name="code">one</field> 
    <field name="title">Adventures</field> 
    <field name="content_english">Especially the fuzzy search is very welcome; Solr really is a beautiful engine and it’s incredibly fast: millions of documents are no problem. Of course, if your servers capacities are configured correctly.</field>  
</doc> 
関連する問題