fabriziofortino commented on code in PR #2346:
URL: https://github.com/apache/jackrabbit-oak/pull/2346#discussion_r2163366570


##########
oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/query/ElasticRequestHandler.java:
##########
@@ -1123,7 +1127,20 @@ private Query createQuery(String propertyName, 
Filter.PropertyRestriction pr, Pr
         final String field = 
elasticIndexDefinition.getElasticKeyword(propertyName);
 
         if (pr.isNullRestriction()) {
-            return Query.of(q -> q.bool(b -> b.mustNot(m -> m.exists(e -> 
e.field(field)))));
+            // nullProps check has been added since 1.4.0. Use the old 
strategy when version is lower
+            if 
(elasticIndexDefinition.getMappingVersion().compareTo(MINIMUM_NULL_CHECK_VERSION)
 < 0) {
+                // check if the default mapping is >= 1.5.0
+                if (ElasticIndexDefinition.MAPPING_VERSION != null &&
+                        ElasticIndexDefinition.MAPPING_VERSION.compareTo(new 
ElasticSemVer(1, 5, 0)) >= 0) {
+                    LOG.error("Backward compatibility for null check is not 
supported anymore. Query results may be incorrect. " +

Review Comment:
   I thought about that but I decided to not add this complexity for the 
following reasons:
   * this message is not printed for every query, only the once using `is null` 
(which shouldn't be that common)
   * we have a way to get rid of these logs: reindexing is required and it will 
improve both response time and resource usage



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: oak-dev-unsubscr...@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to