我正在使用Solr 6.5.0,我遇到了一个场景,我必须为文档中可能包含多种语言的数据字段建立索引。Solr返回错误#400(错误请求)url
我想为每种语言使用单独的字段,我必须将特定语言的数据编入索引,以便为该语言定义的相应字段编制索引。
我增加了以下配置和架构的变化:
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>
每当我更新的核心,我',提示以下错误:
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