[ 
https://issues.apache.org/jira/browse/SOLR-10521?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15987823#comment-15987823
 ] 

Stephen Weiss commented on SOLR-10521:
--------------------------------------

I'm thinking about how I would use this.  And I do think it will probably come 
up.  Most likely, I will want to both sort on a child (or grandchild, etc) 
field, and I will want to actually know what was in that field. 

So:

a) It's important to include that extra $q parameter - don't assume there is 
only one level of children.
b) Would it perhaps make more sense, and be easier on the QueryComponent, if 
you could just include arbitrary child / grandchild field values in the parent 
result set (perhaps, appearing as a multi-valued field?)  If you did this, 
could you then simply sort on the resulting field?  Ie, instead of changing the 
syntax of sort, allow child fields to be added to the response, and then sort 
them using the normal mechanism.  I feel like it would be easier to modify the 
"fl" parameter because there's already a bracket syntax there (for example, for 
[docid]).  Or maybe this already exists and I'm not aware of it?  Something 
like fl=id,name,[!childfield=price_that_day object_type=sku_history price]  and 
then sort=price_that_day desc?  Actually, now that you mention it, I think we 
do have a ticket in the backlog that this feature would actually make feasible!

> 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.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}}- 
> {{sort=\childfield(COLOR_s,&q) 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 marshaled and unmarshalled by a field type from 
> the 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]

Reply via email to