Search code examples
solrmetadataapache-tikasolr-cell

Tika Solr Metadata mapping ignore document 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?


Solution

  • 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.