twosom commented on code in PR #12044:
URL: https://github.com/apache/lucene/pull/12044#discussion_r1058339574
##########
lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseCompletionFilter.java:
##########
@@ -98,20 +98,16 @@ public void reset() throws IOException {
@Override
public boolean incrementToken() throws IOException {
mayIncrementToken();
- if (tokenGenerator.hasNext()) {
- clearAttributes();
- CompletionToken token = tokenGenerator.next();
- termAttr.setEmpty().append(token.term);
- if (token.isFirst) {
- posIncAtt.setPositionIncrement(1);
- } else {
- posIncAtt.setPositionIncrement(0);
- }
- offsetAtt.setOffset(token.startOffset, token.endOffset);
- return true;
- } else {
+ if (tokenGenerator.hasNext() == false) {
return false;
}
+
+ clearAttributes();
+ CompletionToken token = tokenGenerator.next();
+ termAttr.setEmpty().append(token.term);
+ posIncAtt.setPositionIncrement(token.isFirst ? 1 : 0);
+ offsetAtt.setOffset(token.startOffset, token.endOffset);
+ return true;
Review Comment:
@rmuir
In my opinion, this part is much readable for me.
can i ask your opinion?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]