I did, using the example:

<dataConfig>
    <dataSource type="JdbcDataSource"
driver="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@127.0.0.1:1521:XY" user="root"/>
    <document>
        <script><![CDATA[
                        function f1(row)        {
                            row.put('id', 'Test');
                            return row;
                        }
                ]]></script>
        <entity name="user" pk="id" transformer="script:f1" query = "SELECT
* FROM user">
        </entity>
    </document>
</dataConfig>


-----Original Message-----
From: noble.p...@gmail.com [mailto:noble.p...@gmail.com] On Behalf Of Noble
Paul ??????? ??????
Sent: Friday, October 23, 2009 10:36 AM
To: solr-dev@lucene.apache.org
Subject: Re: Dinamic field name with Data import handler

could you paste your dataconfig.xml?
On Fri, Oct 23, 2009 at 5:48 PM, Renata Mota
<renata.m...@accurate.com.br> wrote:
> Ok, thanks Noble Paul.
>
> But, now, i am trying to use ScriptTransformer (where, we must use Java6,
> and i am), but is happening the error below, I tried to use in different
> servers, both use java6 and same error:
>
> SEVERE: Exception while processing: index document : SolrInputDocumnt[{}]
> org.apache.solr.handler.dataimport.DataImportHandlerException: <script>
can
> be used only in java 6 or above Processing Document # 1
> at
>
org.apache.solr.handler.dataimport.ScriptTransformer.initEngine(ScriptTransf
> ormer.java:89)
> at
>
org.apache.solr.handler.dataimport.ScriptTransformer.transformRow(ScriptTran
> sformer.java:50)
> at
>
org.apache.solr.handler.dataimport.EntityProcessorBase.applyTransformer(Enti
> tyProcessorBase.java:186)
> at
>
org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProce
> ssor.java:80)
> at
>
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:
> 285)
> at
>
org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:178
> )
> at
> org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:136)
> at
>
org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.ja
> va:334)
> at
>
org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:386
> )
> at
>
org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:377)
> Caused by: java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> )
>        at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at
>
org.apache.solr.handler.dataimport.ScriptTransformer.initEngine(ScriptTransf
> ormer.java:83)
>        ... 9 more
> Caused by: java.lang.NullPointerException
>        at
>
javax.script.ScriptEngineManager.getEngineByName(ScriptEngineManager.java:19
> 9)
>
> -----Original Message-----
> From: noble.p...@gmail.com [mailto:noble.p...@gmail.com] On Behalf Of
Noble
> Paul ??????? ??????
> Sent: Friday, October 23, 2009 3:02 AM
> To: solr-dev@lucene.apache.org
> Subject: Re: Dinamic field name with Data import handler
>
> not like this.  column and name cannot support templates. But you can
> use a Transformer to add new fields . you may write a simple
> javascript to do so.
> http://wiki.apache.org/solr/DataImportHandler#ScriptTransformer
>
> On Thu, Oct 22, 2009 at 7:51 PM, Renata Mota
> <renata.m...@accurate.com.br> wrote:
>> Hi,
>>
>>
>>
>> I’m trying to give dynamic names for a field with data import handler,
but
> i
>> don’t get.
>>
>>
>>
>> Example:
>>
>>
>>
>> <entity name="users" query = "SELECT ID, NAME FROM USER">
>>
>> <field column="NAME" name="name_'${ users. id}'_s" />
>>
>> </entity>
>>
>>
>>
>> It’s possible to do something like this?
>>
>>
>>
>>
>>
>> Thanks,
>>
>>
>>
>>
>>
>> Renata Gonçalves Mota
>>  <mailto:renata.m...@accurate.com.br> renata.m...@accurate.com.br
>> Tel.: 55 11 3522-7723 R.3018
>>
>>
>>
>>
>
>
>
> --
> -----------------------------------------------------
> Noble Paul | Principal Engineer| AOL | http://aol.com
>
>



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

Reply via email to