Hi Lucas,

check out the thread:
DataImportHandler / Import from DB : one data set comes in multiple rows


I am doing this successfully with my custom EntityProcessor as described in that thread. If you have any more questions or need some more code examples, just ask. I'd be glad to help!


Just wondering: In your SQL statement the ID that you want to use as unique ID in SOLR is called "GROUP". You are sure you don't want to create one SOLR document per ITEM_ID and add the GROUP ID as a field so that you can sort and facet based on it? (Of course, you can facet based on ITEM_ID in the other case, as well.)

Cheers,
Chantal

Noble Paul നോബിള്‍ नोब्ळ् schrieb:
how do you know that all the rows with the same group id has already come?
transformer can store the row and return null till you collect all the
rows and then you may return one consolidated row. But the problem is
it does not know when the row ends.

you can override the SqlEntityProcessor and just override the
nextRow() this should do the trick

On Fri, Oct 30, 2009 at 1:52 AM, Lucas F. A. Teixeira
<lucas...@gmail.com> wrote:
Hello all,

Is it possible to have my own implemented transformer that generates some
output data from data of 2 different rows?
My intention is to generate pre-processed HTML from a set of rows.

Eg.

SQL RESULT:
GROUP | ITEM_ID | DESCRIPTION
1     | 8       | desc1
1     | 23      | desc2
1     | 563     | desc3
2     | 43      | desc4
2     | 3222    | desc5

And with this result, build a Transformer to group all entries in the same
group and build a html using them. My idea in the final index is to have 2
docs with

<DOC>
 * id=1
 * content = "<ul class='1'><li class='8'>desc1</li><li
class='23'>desc2</li><li class='563'>desc3</li></ul>"


<DOC>
 * id=2
 * content = "<ul class='2'><li class='43'>desc4</li><li
class='3222'>desc5</li></ul>"


I've builted some custom transformers before, but never using data from
different rows.

If this is not possible with transformers, how can I achieve this?

Thanks!




Lucas Frare Teixeira .·.
- lucas...@gmail.com
- lucastex.com.br
- blog.lucastex.com
- twitter.com/lucastex




--
-----------------------------------------------------
Noble Paul | Principal Engineer| AOL | http://aol.com

Reply via email to