[
https://issues.apache.org/jira/browse/SOLR-10521?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15985491#comment-15985491
]
Mikhail Khludnev commented on SOLR-10521:
-----------------------------------------
Here is the problem. QueryComponent needs to decide about a field type to
[marshal|https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java#L664]
and
[unmarshal|https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java#L1250]
sort values.
* it works as expected when {{sort=name asc}}. The correct field type is put to
{{SortSpec.fields}}
[here|https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/search/SortSpecParsing.java#L203].
And then it's used to marshall {{ByteRef}} to {{String}} and back.
* it works surprisingly fine when sorting by function like {{sort=sum(age, 42)
asc}}. In this case {{SortSpecParsing}} [puts
null|https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/search/SortSpecParsing.java#L154]
into {{SortSpec.fields}}. And then this null disables any marshaling that
allows passing doubles and ints through javabin serialization (I care about
SolrCloud), but it makes impossible to have a sort field returning
{{BytesRef}}, because they are grabled with javabin. For example
{{sort=field(name) asc}} doesn't work.
Do you have an idea how to introduce {{sort=childfield(name) asc}}, without
giving a lobotomy to -myself- QueryComponent?
> sort by string field of the nested child when searching with {!parent}
> ----------------------------------------------------------------------
>
> Key: SOLR-10521
> URL: https://issues.apache.org/jira/browse/SOLR-10521
> Project: Solr
> Issue Type: New Feature
> Security Level: Public(Default Security Level. Issues are Public)
> Reporter: Mikhail Khludnev
> Attachments: SOLR-10521.patch, SOLR-10521.patch, SOLR-10521-raw.patch
>
>
> The idea is to integrate Lucene's {{ToParentBlockJoinSortField}}
> The approach to hookup it is a little bit tricky:
> {{sort=\{!childfield bjq=$q field=COLOR_s}desc}}
> the question no.1 wdyt about the syntax?
> internally it creates a function query with valueSource which produces
> {{ToParentBlockJoinSortField}}
> The main challenge is picking Solr field type from
> {{ToParentBlockJoinSortField}}, because as-is it's broken on {{mergeIds}} -
> ByteRefs need to be properly marshared and unmarshalled by a field type from
> child scope.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]