You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "poiremo@googlemail.com" <po...@googlemail.com> on 2012/11/08 18:31:35 UTC

Splitting data into an array / lookup

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.

Re: Splitting data into an array / lookup

Posted by Amit Nithian <an...@gmail.com>.
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, poiremo@googlemail.com <
poiremo@googlemail.com> 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.
>