Remove log statement in the isLike handling of the Lucene index for compatVersion 1 and add comment explaining the issues with that code and that we will not fix it (class is deprecated).
@@ -765,8 +765,12 @@ public class LuceneIndex implements AdvanceFulltextQueryIndex {
}
if (isLike) {
- // This code may be unreachable. Adding a log statement to try to identify usages of this code
- LOG.info("Transforming 'like' constraint {} for restriction {}", first, pr);
+ // Note: the code below has two problems:
+ // - Does not deal with escaped wildcard characters (OAK-9885).
+ // - Does not apply the prefix query optimization: the first block of the if condition below is
+ // never executed because the guard condition is always false (OAK-9881).
+ // The correct logic is in LucenePropertyIndex#createLikeQuery.
+ // Leaving the code as it is, because this class is deprecated, as it is just for compatVersion=1
first = first.replace('%', WildcardQuery.WILDCARD_STRING);
first = first.replace('_', WildcardQuery.WILDCARD_CHAR);
