0

我已经配置了一个 dih-import.xml,如下所示。FileListEntityProcessor遍历一些文件夹,然后为每个文件执行一个 XPathEntity 和一个 DB-Entity 。

当我对大约 30.000 个文件执行完全导入时,导入花了将近 3 个小时。回到 DIH 调试控制台,它向我显示,对于找到的第一个文件,进行了 2 个 db 调用,对于第二个 4,然后是 6、8、..

谷歌没有向我展示关于这个主题的任何内容,所以我希望你:)

提前致谢

<?xml version="1.0" encoding="UTF-8"?>
<dataConfig>
    <dataSource 
        name="cr-db"
        jndiName="xyz"
        type="JdbcDataSource" />
    <dataSource 
        name="cr-xml" 
        type="FileDataSource" 
        encoding="utf-8" />


    <document name="doc">
        <entity 
            dataSource="cr-xml" 
            name="f" 
            processor="FileListEntityProcessor" 
            baseDir="/path/to/xml" 
            filename="*.xml" 
            recursive="true" 
            rootEntity="true" 
            onError="skip">
            <entity
                name="xml-data" 
                dataSource="cr-xml" 
                processor="XPathEntityProcessor" 
                forEach="/root" 
                url="${f.fileAbsolutePath}" 
                transformer="DateFormatTransformer" 
                onError="skip">
                <field column="id" xpath="/root/id" /> 

                <field column="A" xpath="/root/a" />
            </entity>

            <entity 
                name="db-data" 
                dataSource="cr-db"
                query="
                    SELECT  
                        id, b
                    FROM 
                        a_table
                    WHERE 
                        id = '${f.file}'">
                <field column="B" name="b" />
            </entity>
        </entity>
    </document>
</dataConfig>

编辑 在谷歌发现问题,但也没有答案:http: //osdir.com/ml/solr-user.lucene.apache.org/2010-04/msg00138.html


和另一个编辑

将 solr 从 3.6 更新到 4.1 并执行导入程序。问题仍然存在,只是不再有 2n (2, 4, 6, 8, ..) 调用子实体,而只有 n。

4

1 回答 1

1

如果主要问题是使用 JdbcDataSource 时数据库的命中次数,您可以尝试切换到CachedSqlEntityProcessor

您可能还想跟踪SOLR-2943,因为他们想准确解决您的问题,希望即将推出的 Solr 4.2

于 2013-03-07T16:17:45.867 回答