Failed to get calculated distance in Spatial Solr queries.

I use this plugin to enable spatial queries in Solr . I followed the steps included in the documentation and I have spatial queries that work fine.

Now I want to get the calculated distance. I added these lines to the solrconfig.xml file:

<searchComponent name="geodistance" class="nl.jteam.search.solrext.spatial.GeoDistanceComponent">
    <defaults>
        <str name="distanceField">geo_distance</str>
    </defaults>
</searchComponent>

And I added the "geodistance" component to the standard request handlers:

  <requestHandler name="standard" class="solr.SearchHandler" default="true">
     <lst name="defaults">
       <str name="echoParams">explicit</str>
     </lst>
    <arr name="components">
        <str>query</str>
        <str>geodistance</str>
    </arr>
  </requestHandler>

Then, when I run a query such as "q = {! Space lat = 41.641184 long = -0.894032 radius = 2 calc = arc unit = km} cafeteria" works, but only for the first time. When I run the same query again, I get this error:

GRAVE: java.lang.NullPointerException
    at nl.jteam.search.solrext.spatial.DistanceFieldValueSource.getValues(DistanceFieldValueSource.java:57)
    at nl.jteam.search.solrext.spatial.GeoDistanceComponent.process(GeoDistanceComponent.java:60)
    at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:195)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:1316)

, , , , "geo_distance". NullPointerException.

+3
1

​​ 1.0-RC5. .

+1

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


All Articles