Waldemar Kłaczyński (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *commented* on HSEARCH-3889 (
https://hibernate.atlassian.net/browse/HSEARCH-3889?atlOrigin=eyJpIjoiMGQ...
)
Re: Exception Predicate targets unexpected fields when use nested() in sort filter (
https://hibernate.atlassian.net/browse/HSEARCH-3889?atlOrigin=eyJpIjoiMGQ...
)
This has to do with the
"AbstractLuceneNestablePredicateBuilder.checkNestableWithin" function. For
nested queries for which nesting is the same as the nesting value, this check should not
be performed. Check only when required. To fix this error is to swap
"#checkNestableWithin" in the "#build" function.
diff --git
a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/search/predicate/impl/AbstractLuceneNestablePredicateBuilder.java
b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/search/predicate/impl/AbstractLuceneNestablePredicateBuilder.java
index d6624fa..f502e67 100644
---
a/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/search/predicate/impl/AbstractLuceneNestablePredicateBuilder.java
+++
b/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/search/predicate/impl/AbstractLuceneNestablePredicateBuilder.java
@@ -33,8 +33,6 @@
@Override
public final Query build(LuceneSearchPredicateContext context) {
- checkNestableWithin( context.getNestedPath() );
-
List<String> nestedPathHierarchy = getNestedPathHierarchy();
String expectedNestedPath = nestedPathHierarchy.isEmpty() ? null
: nestedPathHierarchy.get( nestedPathHierarchy.size() - 1 );
@@ -44,6 +42,8 @@
return super.build( context );
}
+ checkNestableWithin( context.getNestedPath() );
+
// The context we expect this predicate to be built in.
// We'll make sure to wrap it in nested predicates as appropriate in the next few
lines,
// so that the Query is actually executed in this context.
(
https://hibernate.atlassian.net/browse/HSEARCH-3889#add-comment?atlOrigin...
) Add Comment (
https://hibernate.atlassian.net/browse/HSEARCH-3889#add-comment?atlOrigin...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100124- sha1:185bad4 )