![](/img/trans.png)
[英]Obtaining Image File Metadata and Indexing to Solr using TikaEntityProcessor
[英]Solr 5.0 Tika TikaEntityProcessor indexing one document
我有一些文件存儲在一個文件夾中,我正在使用tika定期將它們導入Solr。
data-import.xml文件是:
<dataSource name="tika" type="BinFileDataSource" />
<document>
<entity dataSource="tika" name="files" rootEntity="false"
processor="FileListEntityProcessor"
baseDir="/home/user/public_html/files" fileName=".*\.(doc)|(pdf)|(docx)"
onError="skip"
recursive="true">
<field column="fileAbsolutePath" name="id" />
<field column="fileSize" name="size_i" />
<field column="fileLastModified" name="lastModified_s" />
<entity
name="documentImport"
processor="TikaEntityProcessor"
url="${files.fileAbsolutePath}"
format="text"
dataSource="tika">
<field column="file" name="fileName_s"/>
<field column="Author" name="author_s" meta="true"/>
<field column="title" name="title_s" meta="true"/>
<field column="text" name="details_s"/>
<field column="text" name="_text"/>
</entity>
</entity>
</document>
</dataSource>
目前正在發生的是solr正在讀取所有文件,但它實際上只處理第一個文件,看來一旦導入第一個文件,文檔指針就會設置為#2,並且在整個文件的其余部分保持為空文件。 這似乎只在填充的文檔上增加。
這是導入字段時solr的輸出,正如您在第一個文件導入文檔#1(D#1)和文檔#2(D#2)上看到的那樣,D#1有內容而D#2是空。
在任何后續行中,不會創建D#1,但D#2仍為空。
"----------- row #1-------------",
"fileSize",
2161971,
"fileLastModified",
"2013-06-27T15:40:17Z",
"fileAbsolutePath",
"/home/user/public_html/files/test1.pdf",
"fileDir",
"/home/user/public_html/files",
"file",
"test1.pdf",
null,
"---------------------------------------------",
"entity:documentImport",
[
"document#1",
[
"query",
"/home/user/public_html/files/test1.pdf",
"time-taken",
"0:0:0.0",
null,
"----------- row #1-------------",
"text",
"blah! testing.",
"title",
"testing",
"Author",
"user",
null,
"---------------------------------------------"
],
"document#2",
[]
],
null,
"----------- row #2-------------",
"fileSize",
567396,
"fileLastModified",
"2014-02-17T14:46:55Z",
"fileAbsolutePath",
"/home/user/public_html/files/test2.pdf",
"fileDir",
"/home/user/public_html/files",
"file",
"test2.pdf",
null,
"---------------------------------------------",
"entity:documentImport",
[
"document#2",
[]
],
任何人都可以告訴我如何重置documentImport上的指針或如何讓它導入所有文件而不是一個?
非常感謝
更新#1:我已經使用相同的配置安裝了Solr 4.10.3並且它現在正在工作,我相信這個問題可能是由多種東西引起的,但最引人注目的是從Tika 1.5升級 - > Tika 1.7在4.10之間。 3和5.0.0
如果有人能在我向前推進之前確認。
我有使用過的Tika和Solr,以下是我的data-config.xml
<dataConfig>
<dataSource name="bin" type="BinFileDataSource" />
<document>
<entity name="files" dataSource="null" rootEntity="false"
processor="FileListEntityProcessor"
baseDir="/home/user/public_html/files" fileName=".*\.(doc)|(pdf)|(docx)"
onError="skip"
recursive="true">
<field column="fileAbsolutePath" name="id" />
<field column="fileSize" name="size" />
<field column="fileLastModified" name="lastModified" />
<entity
name="documentImport" dataSource="bin"
processor="TikaEntityProcessor"
url="${files.fileAbsolutePath}"
format="text" onError="skip">
<field column="file" name="fileName"/>
<field column="Author" name="author" meta="true"/>
<field column="title" name="title" meta="true"/>
<field column="text" name="text"/>
</entity>
</entity>
</document>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.