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 "Lucas F. A. Teixeira" <lu...@gmail.com> on 2009/10/29 21:22:26 UTC
Is it possible to a Transform handle data from 2 rows?
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 .·.
- lucastex@gmail.com
- lucastex.com.br
- blog.lucastex.com
- twitter.com/lucastex
Re: Is it possible to a Transform handle data from 2 rows?
Posted by "Lucas F. A. Teixeira" <lu...@gmail.com>.
Hello Chantal!
Thanks for your reply!
Actually, in my case, faceting will not help me because I really need all
"rows" from the same group at index time.
That's because I'll use all rows from the same group, merge them all into a
Velocity (or any other template engine) to generate an HTML that will have
all items information and willbe queries with the group id param.
For example, the select will return all stores (group) and departments
(item) in my system.
I'll generate an index with N docs, each one with the store id (group) and
the final HTML for all its departments!
Got it?
What you are doing, is any similar to this?
Thanks!
Lucas Frare Teixeira .·.
- lucastex@gmail.com
- lucastex.com.br
- blog.lucastex.com
- twitter.com/lucastex
On Fri, Oct 30, 2009 at 7:32 AM, Chantal Ackermann <
chantal.ackermann@btelligent.de> wrote:
> 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
>> <lu...@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 .·.
>>> - lucastex@gmail.com
>>> - lucastex.com.br
>>> - blog.lucastex.com
>>> - twitter.com/lucastex
>>>
>>>
>>
>>
>> --
>> -----------------------------------------------------
>> Noble Paul | Principal Engineer| AOL | http://aol.com
>>
>
Re: Is it possible to a Transform handle data from 2 rows?
Posted by Chantal Ackermann <ch...@btelligent.de>.
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
> <lu...@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 .·.
>> - lucastex@gmail.com
>> - lucastex.com.br
>> - blog.lucastex.com
>> - twitter.com/lucastex
>>
>
>
>
> --
> -----------------------------------------------------
> Noble Paul | Principal Engineer| AOL | http://aol.com
Re: Is it possible to a Transform handle data from 2 rows?
Posted by Noble Paul നോബിള് नोब्ळ् <no...@corp.aol.com>.
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
<lu...@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 .·.
> - lucastex@gmail.com
> - lucastex.com.br
> - blog.lucastex.com
> - twitter.com/lucastex
>
--
-----------------------------------------------------
Noble Paul | Principal Engineer| AOL | http://aol.com