使用 TikaEntityProcessor 时如何在 Solr 中存储文件路径 [英] how to store file path in Solr when using TikaEntityProcessor
本文介绍了使用 TikaEntityProcessor 时如何在 Solr 中存储文件路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 DIH 来索引本地文件系统.但是文件路径、大小和上次修改的字段没有存储.在我定义的 schema.xml 中:
I am using DIH to index local file system. But the file path, size and lastmodified field were not stored. in the schema.xml I defined:
<fields>
<field name="title" type="string" indexed="true" stored="true"/>
<field name="author" type="string" indexed="true" stored="true" />
<!--<field name="text" type="text" indexed="true" stored="true" />
liang added-->
<field name="path" type="string" indexed="true" stored="true" />
<field name="size" type="long" indexed="true" stored="true" />
<field name="lastmodified" type="date" indexed="true" stored="true" />
</fields>
并且还定义了 tika-data-config.xml:
And also defined tika-data-config.xml:
<dataConfig>
<dataSource name="bin" type="BinFileDataSource" />
<document>
<entity name="f" dataSource="null" rootEntity="false"
processor="FileListEntityProcessor"
baseDir="E:/my_project/ecmkit/infotouch"
fileName=".*\.(DOC)|(PDF)|(pdf)|(doc)|(docx)|(ppt)" onError="skip"
recursive="true">
<entity name="tika-test" dataSource="bin" processor="TikaEntityProcessor"
url="${f.fileAbsolutePath}" format="text" onError="skip">
<field column="Author" name="author" meta="true"/>
<field column="title" name="title" meta="true"/>
<!--
<field column="text" name="text"/> -->
<field column="fileAbsolutePath" name="path" />
<field column="fileSize" name="size" />
<field column="fileLastModified" name="lastmodified" />
</entity>
</entity>
</document>
</dataConfig>
Solr 版本是 3.5.有什么想法吗?
The Solr version is 3.5. any idea?
提前致谢.
推荐答案
那些数据不是来自 Tika 元数据,所以你应该像这样将它们移动到 FileListEntityProcessor
实体:
Those data don't come from the Tika metadata, so you should move them to the FileListEntityProcessor
entity like this:
<dataConfig>
<dataSource name="bin" type="BinFileDataSource" />
<document>
<entity name="f" dataSource="null" rootEntity="false"
processor="FileListEntityProcessor"
baseDir="/home/luca/Documents"
fileName=".*\.(DOC)|(PDF)|(pdf)|(doc)|(docx)|(ppt)" onError="skip"
recursive="true">
<field column="fileAbsolutePath" name="path" />
<field column="fileSize" name="size" />
<field column="fileLastModified" name="lastmodified" />
<entity name="tika-test" dataSource="bin" processor="TikaEntityProcessor"
url="${f.fileAbsolutePath}" format="text" onError="skip">
<field column="Author" name="author" meta="true"/>
<field column="title" name="title" meta="true"/>
<!--<field column="text" />-->
</entity>
</entity>
</document>
</dataConfig>
这篇关于使用 TikaEntityProcessor 时如何在 Solr 中存储文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文