Uploaded image for project: 'Spring Data for Apache Solr'
  1. Spring Data for Apache Solr
  2. DATASOLR-511

A ValueSource isn't directly available from this field response for geodist() query

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.1 M4 (Moore)
    • Component/s: Core, Repository
    • Labels:
      None

      Description

      While trying to use geodist() query via Spring data solr, we are getting "A ValueSource isn't directly available from this field" error response

      Code for generating geodist function

      Point point = new Point(42.9254,78.8696)
      Criteria criteria = new Criteria()
      criteria.function(new GeoDistanceFunction.Builder(new SimpleField('latLong')).to(point)) 
      
      SimpleQuery query = new SimpleQuery(criteria)
        .addSort(new Sort(Sort.Direction.ASC, 'score'))
      
      // Field in schema
      <field name="latLong" type="location" indexed="true" stored="true" required="true"/>
      
      <fieldType name="location" class="solr.LatLonPointSpatialField" docValues="true"/>

       

      SolrQuery generated by SolrTemplate internally

      q={!func}geodist(latLong,42.9254,78.8696)
      

      Actual Query expected by Solr

      q={!func}geodist()&pt=42.9254,78.8696&sfield=latLong
      

       

      Reference:

      https://lucene.apache.org/solr/guide/7_6/spatial-search.html#SpatialSearch-geodist 

        Attachments

          Activity

            People

            • Assignee:
              cstrobl Christoph Strobl
              Reporter:
              iamvickyav Vigneshwaran
              Last updater:
              Mark Paluch
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: