solr多个pdf文件一次全部索引. [英] solr multiple pdf files indexing all at once.

查看:281
本文介绍了solr多个pdf文件一次全部索引.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用此命令

curl '://localhost:8983/solr/update/extract?literal.id=doc1&commit=true' -F "myfile=@maven_tutorial.pdf"

我们可以通过在solr中指定自己的id(DOC1)来索引单个pdf文件.但我想索引许多pdf文件以一次全部解决.让solr自动跟踪id.

we can index single pdf files,by specifying our own id(DOC1), in solr. But I want to index many pdf files to solr all at once. let solr keep track of id automatically.

请帮助我.

推荐答案

您可以将UUID类型字段用作唯一键. 首先定义UUID字段类型

You can use UUID type field as unique key. First define the UUID field type

<fieldType name="uuid" class="solr.UUIDField" indexed="true" />

在schema.xml中添加您的id字段

Add your id field in the schema.xml

<field name="id" type="uuid" indexed="true" stored="true"  multiValued="false"/>

将此字段设为唯一键

<uniqueKey>id</uniqueKey>

在solrconfig.xml中更新用于自动生成ID的链

In solrconfig.xml update the chain for autogenerating the id

<updateRequestProcessorChain name="uuid">
<updateRequestProcessorChain name="uuid">
    <processor class="solr.UUIDUpdateProcessorFactory">
        <str name="fieldName">id</str>
    </processor>
    <processor class="solr.RunUpdateProcessorFactory" />
</updateRequestProcessorChain>

现在,将此更新链附加到请求处理程序,该请求处理程序将从要提交给solr的pdf文件中提取内容.

Now attach this update chain to the request handler which is extracting the content from the pdf files that you are submitting to solr.

<requestHandler name="/update/extract" 
              startup="lazy"
              class="solr.extraction.ExtractingRequestHandler" >
<lst name="defaults">
  <str name="lowernames">true</str>
  <str name="uprefix">ignored_</str>
  <str name="captureAttr">true</str>
  <str name="fmap.a">links</str>
  <str name="fmap.div">ignored_</str>
  <str name="update.chain">uuid</str>
</lst>

这篇关于solr多个pdf文件一次全部索引.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆