The following example shows how to extract information about a file from a binary file, such as mp3, such as the title and author.
First, we will show our schema. xml
<field name="id" type="string" indexed="true" stored="true" required="true"/><field name="author" type="string" indexed="true" stored="true" multiValued="true"/><field name="title" type="text" indexed="true" stored="true"/><dynamicField name="ignored_*" type="ignored" indexed="false" stored="false" multiValued="true"/>
Then add the following configuration in the solrconfig. xml file:
<requestHandler name="/update/extract" class="org.apache.solr.handler.extraction.ExtractingRequestHandler"><lst name="defaults"> <str name="lowernames">true</str> <str name="uprefix">ignored_</str> <str name="captureAttr">true</str></lst></requestHandler>
Note:
<Str name = "lowernames"> true </str>: converts all metadata field names extracted from binary files to lowercase letters.
<Str name = "uprefix"> ignored _ </str>: field name prefix used if the field names extracted from binary files are not defined in schema. xml.
<Str name = "captureAttr"> true </str>: capture attributes of binary files.
Restart solr Service
curl "http://localhost:8983/solr/update/extract?literal.id=1&commit=true" -F "myfile=@sample.mp3"