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
  • DataImportHandler: Jav... Steffen

Reply via email to