Pergunta

I'm trying to use cache for some entities in my data import handler configuration. Somehow if I use cache, I only get the first value of my multivalued field. My configuration looks like this:

<entity name="product" query="SELECT product_id FROM Product WHERE 1">
    <entity name="strength" query="SELECT *
        FROM Strength WHERE product_id = '${product.product_id}'">
        <entity name="form" query="SELECT CONCAT(parent_route,'|',form_name) AS form_name, LOWER(CONCAT_WS('\n',form_name,parent_route)) AS form_name_s,
                CAST(form_id AS CHAR(10)) AS form_id_string FROM Form WHERE form_id = '${strength.form_id}'"
                transformer="RegexTransformer" 
                cacheImpl="SortedMapBackedCache" cacheLookup="strength.form_id" cacheKey="form_id_string">
                    <field column="form_name" name="form_name" />
                    <field column="form_name_s" splitBy="\n" />
        </entity>
    </entity>
</entity>

There should be two rows returned for the entity "form" but only the first one is visible if cache is enabled. Does Solr not have the ability to cache multiple rows or am I doing something wrong? My Solr version is 4.1.

Foi útil?

Solução

Problem is fixed when the where part of the cached query is removed. I'm not sure the following configuration is ideal but what I understand is the aim is reducing the count of queries.

<entity name="product" query="SELECT product_id FROM Product WHERE 1">
    <entity name="strength" query="SELECT *
        FROM Strength WHERE product_id = '${product.product_id}'">
        <entity name="form" query="SELECT CONCAT(parent_route,'|',form_name) AS form_name, LOWER(CONCAT_WS('\n',form_name,parent_route)) AS form_name_s,
                CAST(form_id AS CHAR(10)) AS form_id_string FROM Form"
                transformer="RegexTransformer" 
                cacheImpl="SortedMapBackedCache" cacheLookup="strength.form_id" cacheKey="form_id_string">
                    <field column="form_name" name="form_name" />
                    <field column="form_name_s" splitBy="\n" />
        </entity>
    </entity>
</entity>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top