Sort by NestedDocsProvider.childDocs always returns all results. The situation is not recommended. If the final results themselves do not contain elements contained in the filter, then they should not sort by these values. As a result, the sorted items do not match and the calculated values.
{noformat} PredicateFinalStep filter = scope.predicate() .nested().objectField( "nested" ).nest( (f) -> { return f.match().field( "nested.active" ).matching( true ); } );
SearchQuery<DocumentReference> query = scope.query() .where( f -> { return f.bool().must( f.matchAll() ) .filter( filter ); } ) .sort( f -> f.field( "nested.additionalDoubleField" ).asc().multi().min() ) .toQuery();{noformat}
[https://github.com/hibernate/hibernate-search/pull/2224/commits/cba7041493eda3680fe00abfa107ba4af606496f#diff-74aab62c51304e2e914e81dd39c66236|https://github.com/hibernate/hibernate-search/pull/2224/commits/cba7041493eda3680fe00abfa107ba4af606496f#diff-74aab62c51304e2e914e81dd39c66236|smart-link] |
|