lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Colgan <kcol...@yahoo.com.INVALID>
Subject Re: Use SqlEntityProcessor in cached mode to repeat a query for a nested child element
Date Thu, 04 Feb 2016 20:57:23 GMT
you're right, that was a mistake in my code - I did actually using cacheKey but that didn't
work so I was looking at the Java class for DIHCacheSupport to see if there were any other
settings I could use https://lucene.apache.org/solr/5_4_0/solr-dataimporthandler/index.html?org/apache/solr/handler/dataimport/DIHCacheSupport.html

There doesn't seem to be a lot of documentation or examples for using cacheKey and SQLEntityProcessor
around.

Regards,Kevin 

    On Thursday, February 4, 2016 9:31 PM, Alexandre Rafalovitch <arafalov@gmail.com>
wrote:
 
 

 Where did cachePrimaryKey comes from? The documentation has cacheKey :
https://cwiki.apache.org/confluence/display/solr/Uploading+Structured+Data+Store+Data+with+the+Data+Import+Handler

Regards,
    Alex.
----
Newsletter and resources for Solr beginners and intermediates:
http://www.solr-start.com/


On 5 February 2016 at 02:53, Kevin Colgan <kcolgan@yahoo.com.invalid> wrote:
> Hi everyone,
>
> Is it possible to use SqlEntityProcessor in cached mode to repeat a query for a nested
child element? I'd like to use the entity query once to consolidate information from the children
to the parent, then another to actually index the entities as children.
>
> Here's an example of what I'm trying to do in the db-config file. The EventsTransformer
consolidates information from child events and adds fields to the parent row. I had to add
the two entities as the EventsTransformer will only add fields to the parent if child=false:
>
> This is NOT working - the child event entities aren't being created
> <entity autoCommit="false" rootEntity="true" encoding="UTF-8" name="houses" query="select
<parent fields> from houses">
>    <entity
>        transformer="EventsTransformer"
>        name="events"
>        query="select '${houses.uid}_events_' || e_id::text AS uuid,<event fields>
from events">
>    <entity
>        child=true
>        processor="SqlEntityProcessor" cachePrimaryKey="events_e_id" cacheLookup="events_parsed.events_e_id"
cacheImpl="SortedMapBackedCache"
>        name="events"
>        query="select <event fields> from events">
> </entity>
>
> This is IS working but the events query is being run twice so indexing is twice as slow
>
> <entity autoCommit="false" rootEntity="true" encoding="UTF-8" name="houses" query="select
<parent fields> from houses">
>    <entity
>        transformer="EventsTransformer"
>        name="events_parsed"
>        query="select '${houses.uid}_events_' || e_id::text AS uuid, e_id::text AS
events_e_id,<event fields> from events">
>    <entity
>        child=true
>        processor="SqlEntityProcessor" cachePrimaryKey="events_e_id" cacheLookup="events_parsed.events_e_id"
cacheImpl="SortedMapBackedCache"
>        transformer="EventsTransformer"
>        name="events_child"
>        query="select <event fields> from events">
> </entity>
>
> Anyone got any idea how to do this? I've already tried nesting the second child entity
inside the other but this didn't work.
> Thanks,Kevin

 
  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message