Solr Geospatial Search returns incorrect distances

I am using Solr 3.6.1 Webapp with the SOLR-2155 patch to support the geohash field. I installed everything as described here: https://github.com/dsmiley/SOLR-2155

From time to time, the search returns the total false distance for each hit. Updating the result will not help. If I change the search offset (for example, listing the second page), everything will be fine again. Even returning to the first page now shows the correct distance.

This is not a webapp, because the json stream that I get directly from Solr contains the same distances as the result. In my case, it is always 20,015.12 km.

Here is my request:

fq={!geofilt} &fl=internalid,score &start=0 &rows=10 &sort=geodist()+asc &sfield=location &pt=53.6,10.11 &d=50 &q={!func}geodist() 
+4
source share
1 answer

I wrote SOLR-2155. I am not particularly happy with the distance sort code; It seems that I forgot something. This should not be some kind of mathematical problem, I think it is some kind of internal Lucene problem. If you have only one dot per document, use solr.LatLonType. If you have several, then .... :-( I do not know what the problem is. In Solr 4, the replacement code for this is called SpatialRecursivePrefixTreeFieldType, and it uses different code, but it is similar, so I'm not sure what the problem will be leave or not. But even then, again, I'm not quite happy with the implementation. I know how I want to do it right, but right now it's not at the top of my TODO list.

By the way, you mostly report an error, and the proper place to report an error will be the problem of the project tracker in question - in this case, GitHub SOLR-2155. StackOverflow doesn't make sense for this.

+3
source

Source: https://habr.com/ru/post/1445509/


All Articles