http://wiki.apache.org/solr/DataImportHandlerFaq#Blob_values_in_my_table_are_added_to_the_Solr_document_as_object_strings_like_B.401f23c5

On Sat, Sep 1, 2012 at 2:17 AM, Cirelli, Stephen J.
<stephen.j.cire...@saic.com> wrote:
> Anyone know why I'm getting this exception? I'm following the example
> here < http://wiki.apache.org/solr/DataImportHandler#ScriptTransformer>
> but I get the below error. The field type in my schema.xml is string,
> text doesn't work either. Why would I get an error that there's no split
> method on a string?
>
> Caused by: sun.org.mozilla.javascript.internal.EvaluatorException: Java
> class "[B" has no public instance field or method named "split".
> (<Unknown source>#52)
>
> Here's the JS
>
>         function parseAttachments(row){
>             var mainDelim = '(|)', subDelim = '-|-',
>                 attRow = [//This must be in the order that it was
> concatinated in the query.
>                                 { index:0, field:'attachmentFileName',
> arr: new java.util.ArrayList()},
>                                 { index:1, field:'attachmentSize',
> arr: new java.util.ArrayList()},
>                                 { index:2, field:'attachmentMIMEType',
> arr: new java.util.ArrayList()},
>                                 { index:3,
> field:'attachmentExtractedText', arr: new java.util.ArrayList()},
>                                 { index:4, field:'attachmentLink',
> arr: new java.util.ArrayList()}
>                 ]
>
>             var allAttachments =
> row.get('attachments').split(mainDelim);
>             for(var i=0,l=allAttachments.length; i<l; i++) {
>                 var attachment = allAttachments[i].split(subDelim);
>
>                 for(var j=0,jl=attRow.length; j<jl; j++){
>                     var itm = attachment[j],
>                         arr = attRow[j].arr;
>                     arr.add(itm);
>                 }
>             }
>             for(var j=0,jl=attRow.length; j<jl; j++){
>                 var itm = attRow[j];
>                 row.put(itm.field, itm.arr);
>             }
>             row.remove('attachments');
>             return row;
>         }

Reply via email to