Splitting data into an array / lookup

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Splitting data into an array / lookup

BobbyBrush
Hey all,

I have a query based on a value I'm getting:-

 <entity name="id" transformer="RegexTransformer"
                query="select * from table">

Where all my fields I want are populated correctly, including the multivalue one which has the format:

<field column="findID" name="findID" splitBy="," />

But I then want to take the values from 'findID' which are in an array at the moment:

<arr name="names"><str>10</str><str>12</str></arr>

and submit them to another table to lookup the values, which I do something like:

 <entity name="findid" query="select findID, findName from table2 where findID  = '${id.findID}'">
                    <field column="findName" name="findName" />
                   </entity>

Which kinda' works, as I get the first value back, and not the second from findID.

The field set in the schema is set to multivalue, but not sure what else I need to do to get all values back into the field.

Any help is appreciated :)
Reply | Threaded
Open this post in threaded view
|

Re: Splitting data into an array / lookup

Amit Nithian
Why not just do the join in the DB via your initial query? You'll be
executing 1 query per *each* ID in your list which is expensive in your
sub-entity. If you just have your query do the joins up front then each row
could be a complete (or nearly complete) document?


On Thu, Nov 8, 2012 at 9:31 AM, [hidden email] <
[hidden email]> wrote:

> Hey all,
>
> I have a query based on a value I'm getting:-
>
>  <entity name="id" transformer="RegexTransformer"
>                 query="select * from table">
>
> Where all my fields I want are populated correctly, including the
> multivalue
> one which has the format:
>
> <field column="findID" name="findID" splitBy="," />
>
> But I then want to take the values from 'findID' which are in an array at
> the moment:
>
> <arr name="names"><str>10</str><str>12</str></arr>
>
> and submit them to another table to lookup the values, which I do something
> like:
>
>  <entity name="findid" query="select findID, findName from table2 where
> findID  = '${id.findID}'">
>                     <field column="findName" name="findName" />
>                    </entity>
>
> Which kinda' works, as I get the first value back, and not the second from
> findID.
>
> The field set in the schema is set to multivalue, but not sure what else I
> need to do to get all values back into the field.
>
> Any help is appreciated :)
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Splitting-data-into-an-array-lookup-tp4019105.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>