unfortunately native JS objects are not handled by the ScriptTransformer yet.
but what you can do in the script is create a new java.util.ArrayList() and add each item into that . some thing like var jsarr = ['term','term','term'] var arr = new java.util.ArrayList(); for each in jsarr... arr.add(item) row.put('terms',arr); On Wed, Nov 19, 2008 at 9:03 PM, Steffen <[EMAIL PROTECTED]> wrote: > Hi everyone, > I'm currently working with the nightly build of Solr (solr-2008-11-17) > and trying to figure out how to transform a row-object with Javascript > to include multiple values (in a single multivalued field). When I try > something like this as a transformer: > function splitTerms(row) { > //each term should be duplicated into count > field-values > //dummy-code to show the idea > row.put('terms',['term','term','term']); > return row; > } > [...] > <entity name="searchfeedback" pk="id" transformer="script:splitTerms" > query="SELECT term,count FROM termtable WHERE id=${parent.id}" /> > > The DataImportHandler debugger returns: > <arr> > <str> > sun.org.mozilla.javascript.internal.NativeArray:[EMAIL PROTECTED] > </str> > </arr> > What it *should* return: > <arr> > <str>term</str> > <str>term</str> > <str>term</str> > </arr> > > So, what am I doing wrong? My transformer will be invoked multiple > times from a MySQL-Query and in turn has to insert multiple values to > the same field during each invocation. It should do something similar > to the RegexTransformer (field splitBy)... is that possible? Right now > I have to use a workaround that includes the term-duplication on the > database sides, which is kinda ugly if a term has to be duplicated a > lot. > Greetings, > Steffen > -- --Noble Paul