why the tikaEntityProcesor does not index the Text

2019-01-29 07:24发布

问题:

<dataConfig>
<dataSource name="test1" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/ACL"  user="root"
                  password="" />

 <dataSource name="test2" type="BinFileDataSource" />
        <document>
            <entity name="files" dataSource="null" rootEntity="false"
            processor="FileListEntityProcessor" transformer="RegexTransformer"
            baseDir="/home/shah/ResearchTestData/TestScore3" fileName="\.(txt)|(pdf)|(docx)"
            onError="skip"
            recursive="true">
                <field column="fileAbsolutePath" name="ID" />
                <field column="fileSize" name="size" />
                <field column="fileLastModified" name="lastModified" />
                <field column="file" name="fileName" regex="(.txt)" replaceWith=""/>
<entity dataSource="test2"
                    name="documentImport"
                    processor="TikaEntityProcessor"
                    url="${files.fileAbsolutePath}"
                    format="text">
                <field column="text" name="Text" />
                <field column="file" name="fileName" regex="(.txt)" replaceWith=""/>


                </entity>
<entity name="item" dataSource="test1" query="select PaperID,PID, Author  from ACL.Test where PaperID='${files.file}'">
            <field column="PaperID" name="id" />
            <field column="Author" name="Author" />
<field column="PID" name="ID" />

        </entity>


</entity>
    </document>
</dataConfig>

I want to index data from two data sources one is text files folder and another is mysql. please I want to know where i am doing the mistake in the above code. the rest of the fields are working but the Text field inside the tikaprocessor entity doesnot index the text field, alone its working but along with mysql it doesnot index the text field.

回答1:

I have solved the problem by declaring the TikaEntityProcessor inside the main entity. I am sharing the correct code for information.

 <dataSource name="test2" type="BinFileDataSource" />
        <document>
            <entity name="files" dataSource="null" rootEntity="false"
            processor="FileListEntityProcessor" transformer="RegexTransformer"
            baseDir="/home/shah/solr/IndexTest" fileName="\.(txt)|(pdf)|(docx)"
            onError="skip"
            recursive="true">

                <field column="fileSize" name="size" />
                <field column="fileLastModified" name="lastModified" />
                <field column="file" name="id" regex="(.txt)" replaceWith=""/>

<entity  dataSource="test2"
                    name="documentImport"
                    processor="TikaEntityProcessor"
                    url="${files.fileAbsolutePath}"
                    format="text">
                <field column="text" name="Text" />

<entity name="item" dataSource="test1" query="select PaperID, ID, VName  from ACL.Score where PaperID='${files.file}'">
            <field column="PaperID" name="PaperID" />
            <field column="ID" name="ID" />
            <field column="VName" name="Venue" />

        </entity>
</entity>

</entity>
    </document>
</dataConfig>


标签: solr solrj