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 jfeist <jf...@llminc.com> on 2013/11/19 22:34:03 UTC

Unable to update dynamic _coordinate field

I'm using solrj and attempting to index some latitude and longitudes.  My
schema.xml has this dynamicField definition:
<dynamicField name="*_coordinate"  type="tdouble" indexed="true" 
stored="false" />

When I attempt to update a document like so
doc.setField("job_coordinate","40.7143,-74.006");

I get the following error:
Exception in thread "main"
org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: ERROR:
[doc=1] Error adding field 'job_coordinate'='40.7143,-74.006' msg=For input
string: "40.7143,-74.006"

However, if I change the field to a location field that is defined in my
schema.xml, like "store", it works fine.  Does anyone know how to add/update
a dynamic coordinate field to documents?  I'm using Solr 4.4.0.



--
View this message in context: http://lucene.472066.n3.nabble.com/Unable-to-update-dynamic-coordinate-field-tp4101992.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Unable to update dynamic _coordinate field

Posted by jfeist <jf...@llminc.com>.
Ah, I see where I went wrong.  I didn't define that dynamic field, it was in
the Solr default schema.xml file.  I thought that adding a dynamic field
called *_coordinate would basically do the same thing for latitude and
longitudes as adding a dynamic field like *_i does for integers, i.e. index
it as lat and long.  But yeah, I see that field exists so the location
fieldType can store the two tdouble values comprising the lat and long. 
Thanks for the explanation.



--
View this message in context: http://lucene.472066.n3.nabble.com/Unable-to-update-dynamic-coordinate-field-tp4101992p4102008.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Unable to update dynamic _coordinate field

Posted by Chris Hostetter <ho...@fucit.org>.
I'm not entirely sure i understand what you are *trying* to do, but what 
you are currently doing is..

1) defining a dynamic field of type "tdouble"
2) indexing a doc with a value that can not be parsed as a double into a 
field that uses this dynamic field

forget that you've named it "coordinate", forget that it's a dynamic field 
-- you've told solr that "job_coordinate" must be a double precision 
float (ie: "1.2", "89765.12345", "-56", etc...) and then you are trying to 
shove a string containing a comma character into it.


: I'm using solrj and attempting to index some latitude and longitudes.  My
: schema.xml has this dynamicField definition:
: <dynamicField name="*_coordinate"  type="tdouble" indexed="true" 
: stored="false" />
: 
: When I attempt to update a document like so
: doc.setField("job_coordinate","40.7143,-74.006");
: 
: I get the following error:
: Exception in thread "main"
: org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: ERROR:
: [doc=1] Error adding field 'job_coordinate'='40.7143,-74.006' msg=For input
: string: "40.7143,-74.006"
: 
: However, if I change the field to a location field that is defined in my
: schema.xml, like "store", it works fine.  Does anyone know how to add/update
: a dynamic coordinate field to documents?  I'm using Solr 4.4.0.



-Hoss