nfsantos commented on code in PR #1964:
URL: https://github.com/apache/jackrabbit-oak/pull/1964#discussion_r1908255107


##########
oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/query/FulltextIndex.java:
##########
@@ -307,7 +307,7 @@ public static String rewriteQueryText(String textsearch) {
                     escaped = false;
                 }
                 rewritten.append(c);
-            } else if (Chars.contains(QUERY_OPERATORS, c)) {
+            } else if (QUERY_OPERATORS.indexOf(c) >= 0) {

Review Comment:
   That would be more expensive. A `Set<Character>` requires boxing the 
elements. And a call to `Set.contains` will box the argument and calculate an 
hash. A linear search on a character array, as String.indexOf does, uses much 
less logic per call and will certainly be faster for an array of just 6 
elements (all contiguous in memory).



-- 
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