Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SOLR 4.2 - solr.LatLonType type vs solr.SpatialRecursivePrefixTreeFieldType

I am currently using SOLR 4.2 to index geospatial data (latitude and longitude data). I have configured my geospatial field as below.

 <fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>   

  <field name="latlong"     type="location"   indexed="true" stored="false" multiValued="true"/>

I just want to make sure that I am using the correct SOLR class for performing geospatial search since I am not sure which of the 2 class(LatLonType vs SpatialRecursivePrefixTreeFieldType) will be supported by future versions of SOLR.

I assume SpatialRecursivePrefixTreeFieldType is an upgraded version of latlong, can someone please confirm if I am right?

like image 492
Learner Avatar asked Oct 05 '22 04:10

Learner


1 Answers

I generally recommend the SpatialRecursivePrefixTreeFieldType. It's better in many ways, but I wouldn't call it an "upgraded version of LatLonType" since that wording suggests it is a derivative which totally false. It's documented here: http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4 The main reason to use LatLonType (perhaps in conjunction with the new field type) is for distance sorting/relevancy which is better implemented by LatLonType still (as of Solr 4.3).

I don't see LatLonType going away any time soon; Solr takes backwards compatibility pretty seriously.

like image 160
David Smiley Avatar answered Oct 18 '22 14:10

David Smiley