Tika Solr 元数据映射忽略文档标题

发布于 2024-12-22 20:05:55 字数 2706 浏览 1 评论 0原文

我有以下 solr 配置文件:

  <requestHandler name="/update/extract" 
                  startup="lazy"
                  class="solr.extraction.ExtractingRequestHandler" >
    <lst name="defaults">
      <!-- All the main content goes into "text"... if you need to return
           the extracted text or do highlighting, use a stored field. -->
      <str name="lowernames">true</str>
      <str name="fmap.content">content</str>
      <str name="fmap.application_name">type</str>
      <str name="fmap.content_type">mime</str>
      <str name="fmap.stream_size">size</str>
      <str name="uprefix">ignored_</str>
      <str name="captureAttr">false</str>
    </lst>
  </requestHandler>

这是我的架构:

   <field name="id" type="string" indexed="true" stored="true" required="true" /> 
   <field name="access_type" type="string" indexed="true" stored="false"/>
   <field name="access_restriction" type="string" indexed="true" stored="false" multiValued="true"/>
   <field name="title" type="string" indexed="true" stored="true" multiValued="true" />
   <field name="tags" type="string" indexed="true" stored="true" multiValued="true"/>
   <field name="content" type="text_en_splitting" indexed="true" stored="true"/>
   <field name="created" type="date" indexed="true" stored="true"/>
   <field name="createdby" type="string" indexed="true" stored="true"/>
   <field name="modified" type="date" indexed="true" stored="true"/>
   <field name="modifiedby" type="string" indexed="true" stored="true"/>
   <field name="source" type="string" indexed="true" stored="true" />
   <field name="version" type="string" indexed="true" stored="true" />
   <field name="resourcelink" type="string" indexed="true" stored="true" />
   <field name="downloadlink" type="string" indexed="true" stored="true" />

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

我想自己设置 title 。但 Tika 不断设置它自己的 title (这就是我暂时设置 multiValued="true" 的原因),我觉得这很奇怪,因为我必须手动映射 stream_size 等内容content_type

这个问题有什么可能的解决方案?

我希望 Tika 覆盖我分配的 title,如下所示:

我有 3 个文档,对于其中一个,Tika 不会提取 title,在本例中,我有自己的标题,我通过 literal.title 设置,当 Tika 提取 title 时,我希望它覆盖我在 literal.title 中传递的标题。这可能吗?

I have the following config file for solr:

  <requestHandler name="/update/extract" 
                  startup="lazy"
                  class="solr.extraction.ExtractingRequestHandler" >
    <lst name="defaults">
      <!-- All the main content goes into "text"... if you need to return
           the extracted text or do highlighting, use a stored field. -->
      <str name="lowernames">true</str>
      <str name="fmap.content">content</str>
      <str name="fmap.application_name">type</str>
      <str name="fmap.content_type">mime</str>
      <str name="fmap.stream_size">size</str>
      <str name="uprefix">ignored_</str>
      <str name="captureAttr">false</str>
    </lst>
  </requestHandler>

and this is my schema:

   <field name="id" type="string" indexed="true" stored="true" required="true" /> 
   <field name="access_type" type="string" indexed="true" stored="false"/>
   <field name="access_restriction" type="string" indexed="true" stored="false" multiValued="true"/>
   <field name="title" type="string" indexed="true" stored="true" multiValued="true" />
   <field name="tags" type="string" indexed="true" stored="true" multiValued="true"/>
   <field name="content" type="text_en_splitting" indexed="true" stored="true"/>
   <field name="created" type="date" indexed="true" stored="true"/>
   <field name="createdby" type="string" indexed="true" stored="true"/>
   <field name="modified" type="date" indexed="true" stored="true"/>
   <field name="modifiedby" type="string" indexed="true" stored="true"/>
   <field name="source" type="string" indexed="true" stored="true" />
   <field name="version" type="string" indexed="true" stored="true" />
   <field name="resourcelink" type="string" indexed="true" stored="true" />
   <field name="downloadlink" type="string" indexed="true" stored="true" />

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

I want to set the title myself. But Tika keeps setting it's own title (that's why I set multiValued="true" temporarily), which I find strange because I have to manually map stuff like stream_size and content_type.

What solution is possible to this issue?

I'd like Tika to override the title I assign, like this:

I have 3 documents, for one of those, Tika doesn't extract a title, in this case, I have my own title I set passing literal.title, when Tika does extract a title, I want it to override the one I passed in literal.title. Is this possible?

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

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

发布评论

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

评论(2

冬天的雪花 2024-12-29 20:05:55

我前段时间也在研究同样的问题,但我也碰壁了:(
我让 Tika 取“title”,并使用literal.other_title_like_field 来存储正确的标题。
这不是最好的解决方案,但对我有用。

I was working on the same issue some time ago, but I hit a wall as well :(
I let Tika take "title", and use literal.other_title_like_field to store proper title.
This is not a best solution, but worked for me.

巷子口的你 2024-12-29 20:05:55

对于那些仍然在解决这个问题的人,我通过添加

<str name="fmap.title">ignored_</str>

我的 ExtractingRequestHandler 默认值来解决它。

For those who are still struggling with this problem, I solved it by adding

<str name="fmap.title">ignored_</str>

in my ExtractingRequestHandler defaults.

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