Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Use fetcher in traditional /tika /rmeta endpoints
    1. update configs/tika-config-basic.xml <basePath> element to get the full path to tika-pipes-tutorial-20221202/docs:  

      Code Block
      languagexml
      titleFileSystemFetcher
      collapsetrue
        <fetcher class="org.apache.tika.pipes.fetcher.fs.FileSystemFetcher">
          <params>
            <name>fsf</name>
            <basePath>/Users/allison/Desktop/tika-pipes-tutorial-20221202/docs</basePath>
          </params>
        </fetcher>


    2. start the server: java -cp "server-bin/*" org.apache.tika.server.core.TikaServerCli -c configs/tika-config-basic.xml
    3. curl -X PUT http://localhost:9998/rmeta -H "fetcherName:fsf" -H "fetchKey:testPDF.pdf" | jq --sort-keys

  2. Use /pipes handler to read from and write to a local file share
    1. update configs/tika-config-basic.xml <basePath> element to get the full path to tika-pipes-tutorial-20221202/docs:  

      Code Block
      languagexml
      titleFileSystemEmitter
      collapsetrue
        <emitters>
          <emitter class="org.apache.tika.pipes.emitter.fs.FileSystemEmitter">
            <params>
              <name>fse</name>
              <basePath>/Users/allison/Desktop/tika-pipes-tutorial-20221202/extracts</basePath>
            </params>
          </emitter>
        </emitters>


    2. start the server: java -cp "server-bin/*" org.apache.tika.server.core.TikaServerCli -c configs/tika-config-basic.xml
    3. curl -X POST -H "Content-Type: application/json" -d @configs/pipes-request-minimal.json http://localhost:9998/pipes

  3. Configure metadata filters and rerun 2.
    1. Copy this and paste it into configs/tika-config-basic.xml

      Code Block
      languagexml
      titleMetadata Filters
      collapsetrue
      <metadataFilters>
        <!-- depending on the file format, some dates do not have a timezone. This
               filter arbitrarily assumes dates have a UTC timezone and will format all
               dates as yyyy-MM-dd'T'HH:mm:ss'Z' whether or not they actually have a timezone.
          -->
        <metadataFilter class="org.apache.tika.metadata.filter.DateNormalizingMetadataFilter"/>
        <metadataFilter class="org.apache.tika.metadata.filter.FieldNameMappingFilter">
          <params>
            <excludeUnmapped>true</excludeUnmapped>
            <mappings>
              <mapping from="X-TIKA:content" to="content_s"/>
              <mapping from="Content-Length" to="length_i"/>
              <mapping from="dc:creator" to="creators_ss"/>
              <mapping from="dc:title" to="title_s"/>
              <mapping from="Content-Type" to="mime_s"/>
              <mapping from="X-TIKA:EXCEPTION:container_exception" to="tika_exception_s"/>
            </mappings>
          </params>
        </metadataFilter>
      </metadataFilters>


    2. Restart the server
    3. Rerun the curl command and look at the output (cat extracts/testPDF.pdf.json | jq --sort-keys)
  4. Use /async handler file share to file share
    1. curl -X POST -H "Content-Type: application/json" -d @configs/async-request-simple.json http://localhost:9998/async

    2. curl -X POST -H "Content-Type: application/json" -d @configs/async-request-full.json http://localhost:9998/async

  5. Run the async processor via tika-app
    1. Configure the basePath element in FileSystemPipesIterator in configs/tika-config-app.xml

      Code Block
      languagexml
      titleFileSystemPipesIterator
      collapsetrue
        <pipesIterator class="org.apache.tika.pipes.pipesiterator.fs.FileSystemPipesIterator">
          <params>
            <fetcherName>fsf</fetcherName>
            <emitterName>fse</emitterName>
            <basePath>/Users/allison/Desktop/tika-pipes-tutorial-20221202/docs</basePath>
          </params>
        </pipesIterator>


    2. java -cp "app-bin/*" org.apache.tika.cli.TikaCLI -a --config=configs/tika-config-app.xml

  6. Configure Solr/OpenSearch/ElasticSearch emitter and run /pipes handler

...


Solr Example (fileshare to Solr)

  1. From the solr directory
    1. bin/solr start
    2. bin/solr create -c tika-example && bin/solr config -c tika-example -p 8983 -action set-user-property -property update.autoCreateFields -value false
  2. From the tika-pipes-tutorial directory

    1. Set the schema in Solr: curl -F 'data=@configs/solr/solr-parent-child-schema.json' http://localhost:8983/solr/tika-example/schema

    2. Configure the basePath element in FileSystemPipesIterator in configs/solr/tika-config-solr.xml

      Code Block
      languagexml
      titleFileSystemPipesIterator
      collapsetrue
        <pipesIterator class="org.apache.tika.pipes.pipesiterator.fs.FileSystemPipesIterator">
          <params>
            <fetcherName>fsf</fetcherName>
            <emitterName>fse</emitterName>
            <basePath>/Users/allison/Desktop/tika-pipes-tutorial-20221202/docs</basePath>
          </params>
        </pipesIterator>


    3. java -cp "app-bin/*" org.apache.tika.cli.TikaCLI -a --config=configs/solr/tika-config-solr.xml



Configure OpenSearch/Elasticsearch

...