所以我试图在Solr 5.4.1上使用Solr CEL和Tika索引文档。我使用默认配置,但是当我导入文档时,我收到此错误:
multiple values encountered for non multiValued field meta:
以下是与错误相关的日志,您可以看到我提供给solr的数据。
125973 INFO (qtp840863278-17) [ x:fusearchiver] o.a.s.c.PluginBag Going to create a new requestHandler with {type = requestHandler,name = /update/extract,class = solr.extraction.ExtractingRequestHandler,args = {defaults={lowernames=true,uprefix=ignored_,captureAttr=true,fmap.a=links,fmap.div=ignored_}}}
127134 INFO (qtp840863278-17) [ x:fusearchiver] o.a.s.u.p.LogUpdateProcessorFactory [fusearchiver] webapp=/solr path=/update/extract params={literal.archiveDate_dt=Mon+Apr+03+21:16:48+EDT+2017&literal._accountId=2&literal.categories=taxes&literal.categories=5498&literal.id=b5701a36-0dec-4746-bb5d-3c307a557cd7&literal._batchId=25&literal._type=document&literal._filename=2016-0664-Form-5498.pdf&literal._employeeNumber=1411&wt=javabin&literal._employeeFuseId=1&literal.effectiveDate_dt=Sat+Dec+31+00:00:00+EST+2016&literal._json={"accountId":2,"archiveDate":1491268608431,"batchId":25,"categories":["taxes","5498"],"effectiveDate":1483160400000,"employeeFuseId":1,"employeeNumber":"1411","fileName":"2016-0664-Form-5498.pdf","id":"b5701a36-0dec-4746-bb5d-3c307a557cd7","imageUrl":null,"path":"2016-0664-Form-5498.pdf","uploadedBy":null,"url":null}&version=2} {} 0 1161
127135 ERROR (qtp840863278-17) [ x:fusearchiver] o.a.s.h.RequestHandlerBase org.apache.solr.common.SolrException: ERROR: [doc=b5701a36-0dec-4746-bb5d-3c307a557cd7] multiple values encountered for non multiValued field meta: [dcterms:modified, 2017-03-16T23:14:41Z, meta:creation-date, 2017-03-16T23:14:41Z, meta:save-date, 2017-03-16T23:14:41Z, pdf:PDFVersion, 1.4, dcterms:created, 2017-03-16T23:14:41Z, Last-Modified, 2017-03-16T23:14:41Z, date, 2017-03-16T23:14:41Z, X-Parsed-By, org.apache.tika.parser.DefaultParser, X-Parsed-By, org.apache.tika.parser.pdf.PDFParser, modified, 2017-03-16T23:14:41Z, xmpTPg:NPages, 2, Creation-Date, 2017-03-16T23:14:41Z, pdf:encrypted, false, created, Thu Mar 16 23:14:41 UTC 2017, stream_size, null, dc:format, application/pdf; version=1.4, producer, Ricoh Americas Corporation, AFP2PDF, Content-Type, application/pdf, xmp:CreatorTool, Ricoh Americas Corporation, AFP2PDF Plus Version: 1.014.10, Last-Save-Date, 2017-03-16T23:14:41Z]
at org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:92)
at org.apache.solr.update.AddUpdateCommand.getLuceneDocument(AddUpdateCommand.java:83)
at org.apache.solr.update.DirectUpdateHandler2.doNormalUpdate(DirectUpdateHandler2.java:273)
at org.apache.solr.update.DirectUpdateHandler2.addDoc0(DirectUpdateHandler2.java:207)
at org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:169)
at org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:69)
at org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:49)
at org.apache.solr.update.processor.DistributedUpdateProcessor.doLocalAdd(DistributedUpdateProcessor.java:924)
at org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:1079)
at org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:702)
at org.apache.solr.update.processor.LogUpdateProcessorFactory$LogUpdateProcessor.processAdd(LogUpdateProcessorFactory.java:104)
at org.apache.solr.handler.extraction.ExtractingDocumentLoader.doAdd(ExtractingDocumentLoader.java:126)
at org.apache.solr.handler.extraction.ExtractingDocumentLoader.addDoc(ExtractingDocumentLoader.java:131)
at org.apache.solr.handler.extraction.ExtractingDocumentLoader.load(ExtractingDocumentLoader.java:237)
at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:70)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:156)
这是我的提取模块的solrconfig.xml:
<requestHandler name="/update/extract"
startup="lazy"
class="solr.extraction.ExtractingRequestHandler" >
<lst name="defaults">
<str name="lowernames">true</str>
<str name="uprefix">ignored_</str>
<!-- capture link hrefs but ignore div attributes -->
<str name="captureAttr">true</str>
<str name="fmap.a">links</str>
<str name="fmap.div">ignored_</str>
</lst>
</requestHandler>
我认为这基本上会标记所有不被忽略的字段,因此不应导入元。我已经通过我的solr架构进行了搜索,并且我没有声明元字段,因此我认为CEL会抛出它。
我使用Solrj导入文档。我还在文档中添加了很多文字。您可以在上面看到我在文字中提供的数据。
为什么我会看到此错误?
我可以简单地让它只提取信息,然后我将它放在一个文本字段中,让它以相同的方式处理HTML以解决这个问题吗?
答案 0 :(得分:0)
此问题的解决方法是在我的solrconfig.xml中的extract的requesthandler配置中引入以下内容:
<str name="fmap.meta">ignored_</str>
我不知道为什么我必须明确这样做。我还必须将lowernames
= false设置为因为我的文字被改变而且这给我带来了严重的问题。这使我确信我应该在Solr之外运行Tika,因为我可以更好地控制它。我想最终添加tesseract,你自己也可以更容易。