【发布时间】:2017-09-02 17:13:36
【问题描述】:
我正在使用 Solr 6.5.0,我遇到了一个场景,我必须索引文档中可能有多种语言的数据字段。
我正在尝试为每种语言使用单独的字段,我必须将特定语言的数据索引到为该语言定义的相应字段。
我在下面添加了配置和架构更改:
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
将文件发布到 [base] url http://localhost:8983/solr/autodetect/update?update.chain=langid 使用 content-type application/xml... 将文件 multilanguage.xml 发布到 [base] SimplePostTool:警告:Solr 返回错误 #400(错误 请求)的网址: http://localhost:8983/solr/autodetect/update?update.chain=langid SimplePostTool:警告:响应:4006org.apache.solr.common.SolrExceptionorg.apache.solr.common.SolrExceptionDocument 缺少必需的 uniqueKey 字段:id400 SimplePostTool:警告: 读取响应时出现 IOException:java.io.IOException: Server 返回的 HTTP 响应代码:400 用于 URL: http://localhost:8983/solr/autodetect/update?update.chain=langid 1 索引的文件。提交 Solr 索引更改为 http://localhost:8983/solr/autodetect/update?update.chain=langid... 花费时间:0:00:00.179
【问题讨论】:
标签: solr