why the tikaEntityProcesor does not index the Text field in the following data-config file?

天涯浪子 提交于 2019-12-29 09:58:28

问题


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


来源:https://stackoverflow.com/questions/46420735/why-the-tikaentityprocesor-does-not-index-the-text-field-in-the-following-data-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!