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 rumford <bj...@rabidquill.com> on 2015/05/19 21:51:47 UTC

Looking up arrays in a sub-entity

I have an entity which extracts records from a MySQL data source. One of the
fields is meant to be a multi-value field, except, this data source does not
store the values. Rather, it stores their ids in a single column as a
pipe-delimited string. The values themselves are in a separate table, in an
entirely different database, on a different server.

I have written a transformer to make an array out of this delimited string,
but after that I'm at a loss. Can I iterate over an array in a sub-entity? I
need to query that second data source for each of the IDs that I find in
each record of the first data source.

Other people who have asked similar questions have been able to solve their
issue with a join, but in my case I cannot.



--
View this message in context: http://lucene.472066.n3.nabble.com/Looking-up-arrays-in-a-sub-entity-tp4206380.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Looking up arrays in a sub-entity

Posted by rumford <bj...@rabidquill.com>.
I was able to get what I wanted by processing the column in question as
massaged text, so that it was a comma-delimited series of IDs, and then
passing that to a subentity query that went something like: SELECT value
FROM othertable WHERE id IN (${master.ids}).

It's slow but I think it's getting the job done.

For better performance I would probably script something to feed Solr
instead of using the DIH.



--
View this message in context: http://lucene.472066.n3.nabble.com/Looking-up-arrays-in-a-sub-entity-tp4206380p4206592.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Looking up arrays in a sub-entity

Posted by Upayavira <uv...@odoko.co.uk>.
Personally, I see this as a limit of the dataimporthandler. It gets you
started, but when your needs get at all complicated, it can't help you.

I would encourage you to write your own indexing code. A little bit of
code that reads over your database, sorts it out in the right way, and
pushes it to Solr over HTTP post will allow you to achieve what you are
aiming for.

Upayavira

On Tue, May 19, 2015, at 08:51 PM, rumford wrote:
> I have an entity which extracts records from a MySQL data source. One of
> the
> fields is meant to be a multi-value field, except, this data source does
> not
> store the values. Rather, it stores their ids in a single column as a
> pipe-delimited string. The values themselves are in a separate table, in
> an
> entirely different database, on a different server.
> 
> I have written a transformer to make an array out of this delimited
> string,
> but after that I'm at a loss. Can I iterate over an array in a
> sub-entity? I
> need to query that second data source for each of the IDs that I find in
> each record of the first data source.
> 
> Other people who have asked similar questions have been able to solve
> their
> issue with a join, but in my case I cannot.
> 
> 
> 
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Looking-up-arrays-in-a-sub-entity-tp4206380.html
> Sent from the Solr - User mailing list archive at Nabble.com.