Solr - DataImportHandler不工作

时间:2014-07-15 04:27:24

标签: solr dataimporthandler

我简单DataImportHandler,这是在我的本地系统而不是在我的服务器上。两种版本的Solr都是相同的,即 Solr 4.6.0

我已经为DataImportHandler尝试了这些配置:

配置1:

<dataConfig>
    <dataSource type="JdbcDataSource"
                driver="org.postgresql.Driver"
                url="jdbc:postgresql://HOST:5432/mydb"
                user="admin"
                password="admin" />

    <script><![CDATA[
                function generate_resource_uri(row)        {
                    row.put('resource_uri', '/api/v1/product/' + row.get('id') + '/');
                    return row;
                }
        ]]></script>

    <document>
        <entity name="products_product"
                query="SELECT id, image_url, impression_url, product_url, manufacturer_name, discount_percentage, short_description, merchant_name, product_name, sku, long_description, date_modified, merchant_id, commission, keywords, product_id, retail_price, date_created FROM products_product"
                transformer="script:generate_resource_uri" >

            <entity name="source" query="select title from products_source where id = '${products_product.id}'"
                    processor="CachedSqlEntityProcessor">
                <field column="title" name="source"/>
            </entity>

            <entity name="currency" query="select code from products_currency where id = '${products_product.id}'"
                    processor="CachedSqlEntityProcessor">
                <field column="code" name="currency"/>
            </entity>

            <entity name="category" query="select title from products_category where id = '${products_product.id}'"
                    processor="CachedSqlEntityProcessor">
                <field column="title" name="category"/>
            </entity>

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

配置2:

<dataConfig>
    <dataSource type="JdbcDataSource"
                driver="org.postgresql.Driver"
                url="jdbc:postgresql://HOST:5432/mydb"
                user="admin"
                password="123456"/>

    <script><![CDATA[
                function generate_resource_uri(row)        {
                    row.put('resource_uri', '/api/v1/product/' + row.get('id') + '/');
                    return row;
                }
        ]]></script>

    <document>
        <entity name="products_product"
                query="SELECT id, image_url, impression_url, product_url, manufacturer_name, discount_percentage, short_description, merchant_name, product_name, sku, long_description, date_modified, merchant_id, commission, keywords, product_id, retail_price, date_created FROM products_product"
                transformer="script:generate_resource_uri" >

            <entity name="source" query="select title from products_source where id = '${products_product.id}'"
                    cachePk="id" cacheLookup="products_product.id" cacheImpl="SortedMapBackedCache">
                <field column="title" name="source"/>
            </entity>

            <entity name="currency" query="select code from products_currency where id = '${products_product.id}'"
                    cachePk="id" cacheLookup="products_product.id" cacheImpl="SortedMapBackedCache">
                <field column="code" name="currency"/>
            </entity>

            <entity name="category" query="select title from products_category where id = '${products_product.id}'"
                    cachePk="id" cacheLookup="products_product.id" cacheImpl="SortedMapBackedCache">
                <field column="title" name="category"/>
            </entity>

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

在本地我有大约2K行,它被正确编入索引,所有子实体都显示出来。 在服务器上,子实体的字段未显示,即源,类别和货币。服务器有大约6M行,这是一个愚蠢的怀疑,但我希望内存不是问题。我的服务器在m1.medium EC2实例上运行,Ubuntu 12.04LTS。

提前致谢:)

0 个答案:

没有答案