简体   繁体   中英

solr tika data import is not working properly

When I do dataimport it indexes only one document, even I have many files in the folder.

solrconfig.xml

<requestHandler name="/dataimport" class="solr.DataImportHandler">
    <lst name="defaults">
      <str name="config">tika-data-config.xml</str>
    </lst>
  </requestHandler>

Schema.xml

<field name="id" type="string" indexed="true" stored="true" multiValued="false" /> 
    <field name="fileName" type="string" indexed="true" stored="true" />
    <field name="author" type="string" indexed="true" stored="true" />
    <field name="title" type="string" indexed="true" stored="true" />

    <field name="size" type="long" indexed="true" stored="true" />
    <field name="lastModified" type="tdate" indexed="true" stored="true" />
    <field name="text" type="text_general" indexed="true" stored="true" multiValued="true"/>

tika-data-config.xml

<dataConfig>
    <dataSource type="BinFileDataSource" />
    <document>
            <entity name="files" dataSource="null" rootEntity="false"
            processor="FileListEntityProcessor"
            baseDir="C:\Users\vellianm\Documents\BBRC\SearchEngine\solr-5.0.0\example\exampledocs\Process_documents\6.SCIM" fileName=".*\.(pdf)|(PDF)"
            onError="skip"
            recursive="true">
                <field column="fileAbsolutePath" name="id" />
                <field column="fileSize" name="size" />
                <field column="fileLastModified" name="lastModified" />
                <entity
                    name="documentImport"
                    processor="TikaEntityProcessor"
                    url="${files.fileAbsolutePath}"
                    format="text">
                    <field column="file" name="fileName"/>
                    <field column="Author" name="author" meta="true"/>
                    <field column="title" name="title" meta="true"/>
                    <field column="text" name="text"/>
                </entity>
        </entity>
    </document>
</dataConfig>

and when I click the dataimport I get the success message as mentioned below.

Last Update: 15:56:02 Indexing completed. Added/Updated: 1 documents. Deleted 0 documents. Requests: 0, Fetched: 33, Skipped: 0, Processed: 1 Started: about 6 hours ago

Here the fetched documents are 33 but processed are only one. Also I cant find any error in log file.

INFO  - 2015-04-17 09:53:48.957; org.apache.solr.handler.dataimport.DataImporter; Starting Full Import
INFO  - 2015-04-17 09:53:48.959; org.apache.solr.core.SolrCore; [tika] webapp=/solr path=/dataimport params={indent=true&command=status&_=1429264428957&wt=json} status=0 QTime=0 
INFO  - 2015-04-17 09:53:48.962; org.apache.solr.handler.dataimport.SimplePropertiesWriter; Read dataimport.properties
INFO  - 2015-04-17 09:53:48.978; org.apache.solr.update.DirectUpdateHandler2; [tika] REMOVING ALL DOCUMENTS FROM INDEX
INFO  - 2015-04-17 09:53:49.124; org.apache.solr.handler.dataimport.DocBuilder; Import completed successfully

This works for me:

<dataConfig>  
<dataSource type="BinFileDataSource" />
    <document>
        <entity name="files" dataSource="null" rootEntity="false"
        processor="FileListEntityProcessor"                     
        baseDir="/tmp/docs"
        fileName=".*\.(DOC)|(PDF)|(pdf)|(doc)|(docx)|(ppt)"
        onError="skip"
        recursive="true">

            <field column="fileAbsolutePath" name="path" />
            <field column="fileSize" name="size" />
            <field column="fileLastModified" name="lastModified" />

            <entity
                name="documentImport"
                processor="TikaEntityProcessor"
                url="${files.fileAbsolutePath}"
                format="text">
                <field column="file" name="fileName"/>
                <field column="Author" name="author" meta="true"/>
                <field column="title" name="title" meta="true"/>
                <field column="text" name="text"/>
                <field column="fileAbsolutePath" name="path" />
                <field column="fileSize" name="size" />
                <field column="fileLastModified" name="lastmodified" />                    
                <field column="LastModifiedBy" name="LastModifiedBy" meta="true"/>
            </entity>
    </entity>
    </document> 
</dataConfig>

note the baseline dir ... the quotes are contrary

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM