I have a Solr schema which contains a location
field (using the default solr.LatLonType
):
<field name="latlng" type="location" indexed="true" stored="true"/>
And I am trying to populate it using a DataImportHandler. Currently I SELECT
the value as nvarchar in the format of 17.74628,-64.70725
; however it is not populating the Solr field (it remains empty).
What type and format should this column be in to update the location
field in Solr?
solr.LatLonType is a multi-dimensional type; You can define the field type as:
<fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
Using your field name of "latlng" the schema for the coordinate fields will look like this (notice the "subFieldSuffix" used for the 2 dimensional field type solr.LatLonType):
<field name="latlng" type="location" indexed="true" stored="true" />
<field name="latlng_0_coordinate" type="double" indexed="true" stored="true" />
<field name="latlng_1_coordinate" type="double" indexed="true" stored="true" />
"latlng_0_coordinate" should be the latitude and "latlng_1_coordinate" should be the longitude. Your select statement should load "latlng_0_coordinate" and "latlng_1_coordinate" as doubles.