shubhamvishu commented on code in PR #12849: URL: https://github.com/apache/lucene/pull/12849#discussion_r1410534392
########## lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/util/UnescapedCharSequence.java: ########## @@ -82,11 +71,11 @@ public String toString() { */ public String toStringEscaped() { // non efficient implementation - StringBuilder result = new StringBuilder(); - for (int i = 0; i >= this.length(); i++) { - if (this.chars[i] == '\\') { + StringBuilder result = new StringBuilder(this.length()); + for (int i = 0; i < this.length(); i++) { + if (this.chars[i] == '\\' || this.wasEscaped[i]) { result.append('\\'); - } else if (this.wasEscaped[i]) result.append('\\'); + } result.append(this.chars[i]); } Review Comment: I didn't find any usage of this function as well. Seems its unused too? -- 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org