簡體   English   中英

在Solr中存儲PDF

[英]Storing PDFs in Solr

我正在嘗試在本地環境中進行設置,以便可以將PDF存儲在Solr中,但無法使其正常工作。 現在,我正在使用Solr提供的示例文件夾中的文件。

我沒有在solr-3.6.0 / example / conf中修改solrconfig.xml,因為它似乎已經按照“ 提取請求處理程序”中所述進行了配置。 也就是說,它已經包含以下內容:

<lib dir="../../dist/" regex="apache-solr-cell-\d.*\.jar" />
<lib dir="../../contrib/extraction/lib" regex=".*\.jar" />

和這個:

<requestHandler name="/update/extract" 
              startup="lazy"
              class="solr.extraction.ExtractingRequestHandler" >
<lst name="defaults">
  <str name="fmap.content">text</str>
  <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>
</lst>

我正在使用以下命令從示例目錄運行Solr:

java -jar start.jar 

我正在嘗試使用以下命令將pdf發送給Solr:

java -Durl=http://localhost:8983/solr/update/extract -Dauto -jar /Applications/Solr-3.6.0/example/exampledocs/post.jar /path/to/pdf/mypdf.pdf

如果我不對/Solr-3.6.0/example/solr/conf/schema.xml進行任何更改,則會收到以下消息:

FATAL: Solr returned an error #400 [doc=null] missing required field: id

如果將schema.xml的id元素中的“必需”屬性值更改為false,則會得到:

FATAL: Solr returned an error #400 Document is missing mandatory uniqueKey field: id

我認為如果元素的必需屬性在架構中為false,那么我可以發送不包含該字段的文件,但是顯然不是這樣。

我也嘗試過在發送該pdf的命令中添加參數-Dparams = literal.id = mypdf1 ,但這無濟於事。 有什么想法嗎?

我相信我的困惑是由於您需要為要發送到Solr的文檔提供一個ID,同時在Solr-3.6.0 / example / solr / conf / 模式中還有一個id元素。 xml

我相信我遇到的第一個錯誤是引用架構中的id元素。 第二個錯誤是引用文檔ID。

在ZeroPage的幫助下,通過將文檔ID添加到url中而不是將其作為單獨的參數傳遞,我還能夠克服第二個錯誤。 這個查詢現在對我有用:

java -Durl=http://localhost:8983/solr/update/extract?literal.id=form1 -jar /Applications/Solr-3.6.0/example/exampledocs/post.jar /path/to/pdf/form1.pdf 

如果我們希望Solr為PDF的全部內容建立索引,則需要添加uprefixfmap.content屬性:

java -Durl="http://localhost:8983/solr/update/extract?literal.id=form1&uprefix=attr_&fmap.content=attr_content&commit=true" -jar /Applications/Solr-3.6.0/example/exampledocs/post.jar /path/to/pdf/form1.pdf

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM