shubhamsrkdev commented on code in PR #16060:
URL: https://github.com/apache/lucene/pull/16060#discussion_r3340568645
##########
lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextTermVectorsReader.java:
##########
@@ -296,18 +297,22 @@ public long size() throws IOException {
}
@Override
- public long getSumTotalTermFreq() throws IOException {
- // TODO: make it constant-time
- long ttf = 0;
- TermsEnum iterator = iterator();
- for (BytesRef b = iterator.next(); b != null; b = iterator.next()) {
- ttf += iterator.totalTermFreq();
+ public long getSumTotalTermFreq() {
+ try {
+ // TODO: make it constant-time by pre-computing during indexing
+ long ttf = 0;
+ TermsEnum iterator = iterator();
+ for (BytesRef b = iterator.next(); b != null; b = iterator.next()) {
+ ttf += iterator.totalTermFreq();
+ }
+ return ttf;
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
Review Comment:
nit: Do we need to add this in changes.txt?
##########
lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextTermVectorsReader.java:
##########
@@ -296,18 +297,22 @@ public long size() throws IOException {
}
@Override
- public long getSumTotalTermFreq() throws IOException {
- // TODO: make it constant-time
- long ttf = 0;
- TermsEnum iterator = iterator();
- for (BytesRef b = iterator.next(); b != null; b = iterator.next()) {
- ttf += iterator.totalTermFreq();
+ public long getSumTotalTermFreq() {
+ try {
+ // TODO: make it constant-time by pre-computing during indexing
+ long ttf = 0;
+ TermsEnum iterator = iterator();
Review Comment:
nit: the above two need not to be in try?
--
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]