I paid a third party coder to develop a schema for Solr but now that I have more of an understanding myself I have a questions.
The aim is to do spacial searching so in my schema I have this:
<field name="latlng" type="location" indexed="true" stored="false" />
<field name="latlng_0_coordinate" type="double" indexed="true" stored="false" />
<field name="latlng_1_coordinate" type="double" indexed="true" stored="false" />
My site submit via JSON to lat_lng_0_coordinate and latlng_1_coordinate but nothing gets submitted to latlng.
Furthermore, there is no other mention of "latlng" in my schema.xml, so its not like there is a combine or join function in there as far as I can see.
So, my question is, does latlng have a purpose or has the coder put it in in error?
latlng field type is defined as location. The definition of the location field is as follows.
<fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
It requires to create dynamic fields with the _coordinate
suffix.
In your example, latlng_0_coordinate
should be used for the lattitude field and latlng_1_coordinate
for the longitude field.
Then by using Spatial queries you can use the latlng field.
For example, in order to find the nearest locations within the 5km with the given point you can use the following query. 41.431, 28.431 are just random locations that I wrote.
{!geofilt sfield=latlng}&pt=41.431,28.431&d=5
As a result, it is not an error, it is there for purpose.
See also in the Solr docs: https://wiki.apache.org/solr/SpatialSearch#QuickStart
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With