I am using Solr 6.5.1
LatLonType is now deprecated (https://lucene.apache.org/solr/guide/6_6/spatial-search.html) and I'm trying to use the LatLonPointSpatialField. I also need it to be multi-valued.
My field is defined as follows:
<fieldType name="location" class="solr.LatLonPointSpatialField" docValues="true"/>
I used to boost on my LatLonType field before like that:
boost=recip(geodist(sfield,45.15,-93.12),3 ,10000,3000)
(I am using eDisMax).
After I changed the spatial data type, I'm getting this error:
A ValueSource isn't directly available from this field. Instead try a query using the distance as the score.
which I don't understand.
The documentation tells nothing about using the geodist
function with edismax to use it in boost=
parameter. Instead it just suggests to use the function value for sorting:
https://lucene.apache.org/solr/guide/6_6/spatial-search.html#SpatialSearch-geodist
However this will not work for me, I don't need to sort on distance, I want the geodist()
function to be multipled with score to change the resulting score.
The solution that worked for me:
Before (LatLonType):
boost=recip(geodist(coordinates_ll,49.175,-123.003),1,10,1)
After (LatLonPointSpatialField):
boost=recip(geodist(),1,10,1)&pt=49.175,-123.003&sfield=coordinates_ll
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