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 JavaGuy84 <bb...@gmail.com> on 2010/01/26 22:15:42 UTC

How to Create dynamic field names using script transformers

Hi,

I am trying to generate a dynamic fieldname using custom transformers but
couldn't achieve the expected results.

My requirement is that I do not want to hardcode some of field names used by
SOLR for indexing, instead the field name should be generated using the data
retreieved from a table.

Any help on this regard is greatly appreciated.

Thanks,
Barani
-- 
View this message in context: http://old.nabble.com/How-to-Create-dynamic-field-names-using-script-transformers-tp27329876p27329876.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: How to Create dynamic field names using script transformers

Posted by JavaGuy84 <bb...@gmail.com>.
Hey Erik,

Thanks a lot for your reply.. I am a newbie to SOLR ...

I am just trying to use the example present in Apache WIKI to understand
"how" the scriptTransformer works. I want to know how to pass the data from
table.field to transformer and get back the data from transformer and set
the value to any field.

    <dataConfig>
             <script><![CDATA[
                     function f1(row)        {
                         row.put('Hello', 'Test');
                         return row;
                     }
             ]]></script>
             <dataSource driver="com......." />

             <document>
                     <entity name="e" pk="id" transformer="script:f1"
query="select * from table1">
                     </entity>
             </document>
</dataConfig>


Basically I want a field like... <field column=”value”
name=”${elementpropertyvalue.propertyName}”/>
and index this field so that users can search on this dynamic field and get
the corresponding data also.


Thanks,
Barani



Erik Hatcher-4 wrote:
> 
> Barani -
> 
> Give us some details of what you tried, what you expected to happen,  
> and what actually happened.
> 
> 	Erik
> 
> 
> On Jan 26, 2010, at 4:15 PM, JavaGuy84 wrote:
> 
>>
>> Hi,
>>
>> I am trying to generate a dynamic fieldname using custom  
>> transformers but
>> couldn't achieve the expected results.
>>
>> My requirement is that I do not want to hardcode some of field names  
>> used by
>> SOLR for indexing, instead the field name should be generated using  
>> the data
>> retreieved from a table.
>>
>> Any help on this regard is greatly appreciated.
>>
>> Thanks,
>> Barani
>> -- 
>> View this message in context:
>> http://old.nabble.com/How-to-Create-dynamic-field-names-using-script-transformers-tp27329876p27329876.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/How-to-Create-dynamic-field-names-using-script-transformers-tp27329876p27330330.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: How to Create dynamic field names using script transformers

Posted by Erik Hatcher <er...@gmail.com>.
Barani -

Give us some details of what you tried, what you expected to happen,  
and what actually happened.

	Erik


On Jan 26, 2010, at 4:15 PM, JavaGuy84 wrote:

>
> Hi,
>
> I am trying to generate a dynamic fieldname using custom  
> transformers but
> couldn't achieve the expected results.
>
> My requirement is that I do not want to hardcode some of field names  
> used by
> SOLR for indexing, instead the field name should be generated using  
> the data
> retreieved from a table.
>
> Any help on this regard is greatly appreciated.
>
> Thanks,
> Barani
> -- 
> View this message in context: http://old.nabble.com/How-to-Create-dynamic-field-names-using-script-transformers-tp27329876p27329876.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>


Re: How to Create dynamic field names using script transformers

Posted by JavaGuy84 <bb...@gmail.com>.
To add some more details, this is what I am trying to acheive...

There are 2 fields present in a database table and I am trying to make those
2 fields as key value pair.

Eg: Consider there are 2 fields associated with each other (Propertyid and
propertyValue)

I want the property id as field name and property value as its field
value..something like...

<1111111>Test<111111111>

Thanks,
Barani


JavaGuy84 wrote:
> 
> Hi,
> 
> I am trying to generate a dynamic fieldname using custom transformers but
> couldn't achieve the expected results.
> 
> My requirement is that I do not want to hardcode some of field names used
> by SOLR for indexing, instead the field name should be generated using the
> data retreieved from a table.
> 
> Any help on this regard is greatly appreciated.
> 
> Thanks,
> Barani
> 

-- 
View this message in context: http://old.nabble.com/How-to-Create-dynamic-field-names-using-script-transformers-tp27329876p27330470.html
Sent from the Solr - User mailing list archive at Nabble.com.