如何使用 Solr 的 FileListEntityProcessor 在搜索结果中显示文件名

发布于 2024-11-07 04:22:38 字数 1160 浏览 7 评论 0原文

我正在尝试扫描目录中的所有 pdf/doc 文件。这工作正常,我可以扫描所有文档。

我想做的下一件事也是接收搜索结果中文件的文件名。但是文件名永远不会显示。我尝试了一些方法,但是文档对于如何执行此操作并不是很有帮助。

我正在使用 solr 发行版中找到的 solr 配置:apache-solr-3.1.0/example/example-DIH/solr/tika/conf

这是我的数据配置:

<dataConfig>
  <dataSource type="BinFileDataSource" name="bin"/>
  <document>
    <entity name="f" processor="FileListEntityProcessor" recursive="true" 
            rootEntity="false" dataSource="null" baseDir="C:/solrtestsmall"
            fileName=".*\.(DOC)|(PDF)|(pdf)|(doc)" onError="skip">

      <entity name="tika-test" processor="TikaEntityProcessor" 
              url="${f.fileAbsolutePath}" format="text" dataSource="bin" 
              onError="skip">
        <field column="Author" name="author" meta="true"/>
        <field column="title" name="title" meta="true"/>
        <field column="text" name="text"/>
      </entity>

      <field column="fileName" name="fileName"/>
    </entity>
  </document>
</dataConfig>

我对如何实现这一点感兴趣正确配置它,以及我可以找到特定文档的任何其他地方。

I am trying to scan all pdf/doc files in a directory. This works fine and I am able to scan all documents.

The next thing i'm trying to do is also receiving the filename of the file in the search results. The filename however never shows up. I tried a couple of things, but the documentation is not very helpfull about how to do this.

I am using the solr configuration found in the solr distribution: apache-solr-3.1.0/example/example-DIH/solr/tika/conf

This is my dataConfig:

<dataConfig>
  <dataSource type="BinFileDataSource" name="bin"/>
  <document>
    <entity name="f" processor="FileListEntityProcessor" recursive="true" 
            rootEntity="false" dataSource="null" baseDir="C:/solrtestsmall"
            fileName=".*\.(DOC)|(PDF)|(pdf)|(doc)" onError="skip">

      <entity name="tika-test" processor="TikaEntityProcessor" 
              url="${f.fileAbsolutePath}" format="text" dataSource="bin" 
              onError="skip">
        <field column="Author" name="author" meta="true"/>
        <field column="title" name="title" meta="true"/>
        <field column="text" name="text"/>
      </entity>

      <field column="fileName" name="fileName"/>
    </entity>
  </document>
</dataConfig>

I am interested in the way how to configure this correctly, and also the any other places I can find specific documentation.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

长梦不多时 2024-11-14 04:22:38

您应该在列中使用文件而不是文件名,

<field column="file" name="fileName"/>

不要忘记将“文件名”添加到字段部分的 schema.xml 中。

<field name="fileName" type="string" indexed="true" stored="true" />

You should use file instead of fileName in column

<field column="file" name="fileName"/>

Don't forget to add the 'fileName' to the schema.xml in the fields section.

<field name="fileName" type="string" indexed="true" stored="true" />
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文