sabi0 commented on code in PR #13041: URL: https://github.com/apache/lucene/pull/13041#discussion_r1487807932
########## lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/TokenizedPhraseQueryNode.java: ########## @@ -70,10 +70,8 @@ public QueryNode cloneTree() throws CloneNotSupportedException { @Override public CharSequence getField() { List<QueryNode> children = getChildren(); - - if (children == null || children.size() == 0) { + if (children == null || children.isEmpty()) { return null; - } else { return ((FieldableNode) children.get(0)).getField(); Review Comment: I think the two methods should be aligned. If one has an assert (assumes all the children are `FieldableNode`) then the other should do so too. Of they both should silently ignore children of other types. I would probably go with "silently ignore children of other types" as the least surprising option. -- 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