[
https://issues.apache.org/jira/browse/SOLR-11601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16255877#comment-16255877
]
Amrit Sarkar commented on SOLR-11601:
-------------------------------------
Hi Clemens,
It doesn't fails it is *intended behavior.* I replicated your scenario on my
system and it threw this stack trace:
{code}
Caused by: org.apache.solr.common.SolrException: A ValueSource isn't directly
available from this field. Instead try a query using the distance as the score.
at
org.apache.solr.schema.AbstractSpatialFieldType.getValueSource(AbstractSpatialFieldType.java:334)
at
org.apache.solr.search.FunctionQParser.parseValueSource(FunctionQParser.java:384)
at
org.apache.solr.search.FunctionQParser.parseValueSourceList(FunctionQParser.java:227)
at
org.apache.solr.search.function.distance.GeoDistValueSourceParser.parse(GeoDistValueSourceParser.java:54)
at
org.apache.solr.search.FunctionQParser.parseValueSource(FunctionQParser.java:370)
at org.apache.solr.search.FunctionQParser.parse(FunctionQParser.java:82)
at org.apache.solr.search.QParser.getQuery(QParser.java:168)
at
org.apache.solr.search.SortSpecParsing.parseSortSpecImpl(SortSpecParsing.java:120)
... 37 more
{code}
When I looked at: at
org.apache.solr.schema.AbstractSpatialFieldType.getValueSource(AbstractSpatialFieldType.java:334)
{code}
@Override
public ValueSource getValueSource(SchemaField field, QParser parser) {
//This is different from Solr 3 LatLonType's approach which uses the
MultiValueSource concept to directly expose
// the x & y pair of FieldCache value sources.
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"A ValueSource isn't directly available from this field. Instead try a
query using the distance as the score.");
}
{code}
_This function only implements this particular use-case and throws that
particular exception._
You should keep using
{{sfield=b4_location__geo_si&pt=47.36667,8.55&sort=geodist() asc}} as it is
neat too, as comparison to geodist(...,...,...).
> solr.LatLonPointSpatialField : sorting by geodist fails
> -------------------------------------------------------
>
> Key: SOLR-11601
> URL: https://issues.apache.org/jira/browse/SOLR-11601
> Project: Solr
> Issue Type: Bug
> Security Level: Public(Default Security Level. Issues are Public)
> Affects Versions: 6.6
> Reporter: Clemens Wyss
> Priority: Blocker
>
> Im switching my schemas from derprecated solr.LatLonType to
> solr.LatLonPointSpatialField.
> Now my sortquery (which used to work with solr.LatLonType):
> *sort=geodist(b4_location__geo_si,47.36667,8.55) asc*
> raises the error
> {color:red}*"sort param could not be parsed as a query, and is not a field
> that exists in the index: geodist(b4_location__geo_si,47.36667,8.55)"*{color}
> Invoking sort using syntax
> {color:#14892c}sfield=b4_location__geo_si&pt=47.36667,8.55&sort=geodist() asc
> works as expected though...{color}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]