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 leonildo <le...@gmail.com> on 2012/12/20 00:26:01 UTC

Using SolrJ to update index with array fields

Hello,

I´m using solr 1.4 

How can I update solr index creating fields that must be updated with arrays
?

My code is:

long arrayOfLong[] = new long [] {1,2,3} ;
SolrInputDocument doc = new SolrInputDocument();
doc.setField(field.getFieldName(), arrayOfLong);

when updating the following error is generated:

Exception in thread "main" org.apache.solr.common.SolrException: Internal
Server Error

Inside the schema.xml file we have:
 <field name="catalog_id" type="long" indexed="true" stored="true"
multiValued="true"/> 

Any help is usefull to me.






--
View this message in context: http://lucene.472066.n3.nabble.com/Using-SolrJ-to-update-index-with-array-fields-tp4028181.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Using SolrJ to update index with array fields

Posted by Erick Erickson <er...@gmail.com>.
Solr doesn't natively handle array types, you probably have to do something
like

for (long l : arryOfLong) {
doc.set(... l );
}

Although I'm not all that familiar with the update set syntax...

FWIW,
Erick


On Wed, Dec 19, 2012 at 6:26 PM, leonildo <le...@gmail.com> wrote:

> Hello,
>
> I´m using solr 1.4
>
> How can I update solr index creating fields that must be updated with
> arrays
> ?
>
> My code is:
>
> long arrayOfLong[] = new long [] {1,2,3} ;
> SolrInputDocument doc = new SolrInputDocument();
> doc.setField(field.getFieldName(), arrayOfLong);
>
> when updating the following error is generated:
>
> Exception in thread "main" org.apache.solr.common.SolrException: Internal
> Server Error
>
> Inside the schema.xml file we have:
>  <field name="catalog_id" type="long" indexed="true" stored="true"
> multiValued="true"/>
>
> Any help is usefull to me.
>
>
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Using-SolrJ-to-update-index-with-array-fields-tp4028181.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>