error adding location coordinates

49 views
Skip to first unread message

gswartz

unread,
Aug 16, 2012, 9:51:03 AM8/16/12
to sol...@googlegroups.com
I have my schema set up with the following node....

 <field name="LocationCoordinates" type="location" indexed="true" stored="true" />

... and my class has the following property....

[SolrField("LocationCoordinates")]
public string LocationCoordinates
{
get
{
if (LocationZipCodeLat.HasValue && LocationZipCodeLon.HasValue)
{
var retval = LocationZipCodeLat.ToString() + "," + LocationZipCodeLon.ToString();
return retval;
}
return ",";
}
}

When LocationZipCodeLat and LocationZipCodeLon have a value I am able to add a document to my solr index.  However, when it gets to the else part which returns "," I get the following error in my log.  

SEVERE: org.apache.solr.common.SolrException: ERROR: [doc=827592] Error adding field 'LocationCoordinates'=','
at org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:333)

I've tried returning string.Empty also but I get the same error.  So, when I have an object without a location, what do I return from this property to be able to add the document?  Thanks.

gswartz

unread,
Aug 16, 2012, 10:18:06 AM8/16/12
to sol...@googlegroups.com
I think I've figured this out.  Rather than returning an empty string I need to return null.
Reply all
Reply to author
Forward
0 new messages