-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup TokenizedPhraseQueryNode code #13041
Conversation
return null; | ||
|
||
} else { | ||
return ((FieldableNode) children.get(0)).getField(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the setField(CharSequence)
method below children are not necessarily FieldableNode
.
I.e. this line might throw ClassCastException
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point. Maybe it's worth adding an assertion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think having the two methods aligned, the way they are in your latest commit, makes sense.
This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the [email protected] list. Thank you for your contribution! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The clean-up looks good. Sorry it took so long to get a review.
return null; | ||
|
||
} else { | ||
return ((FieldableNode) children.get(0)).getField(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point. Maybe it's worth adding an assertion?
lucene/CHANGES.txt
Outdated
@@ -258,6 +258,8 @@ Improvements | |||
Tests are running with random byte order to ensure that the order does not affect correctness | |||
of code. Native order was enabled for LZ4 compression. (Uwe Schindler) | |||
|
|||
* GITHUB#13041: TokenizedPhraseQueryNode code cleanup (Dmitry Cherniachenko) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would have to move up to version 9.11 because 9.10 is already in the release process.
getChildren()
in a variable and re-use itisEmpty()
instead ofsize() == 0
tokenized_t_phrase
=>tokenizedphrase
toString()
call