s1monw commented on a change in pull request #551: LUCENE-8662: Override
seekExact(BytesRef) in FilterLeafReader.FilterTermsEnum
URL: https://github.com/apache/lucene-solr/pull/551#discussion_r252215511
##########
File path: lucene/core/src/java/org/apache/lucene/index/TermsEnum.java
##########
@@ -65,13 +65,26 @@ public AttributeSource attributes() {
NOT_FOUND
};
- /** Attempts to seek to the exact term, returning
- * true if the term is found. If this returns false, the
- * enum is unpositioned. For some codecs, seekExact may
- * be substantially faster than {@link #seekCeil}. */
- public boolean seekExact(BytesRef text) throws IOException {
+ /**
+ * Attempts to seek to the exact term, returning true if the term is found.
If this returns false, the enum is
+ * unpositioned. For some codecs, seekExact may be substantially faster than
{@link #seekCeil}.
+ * <p>
+ *
+ * This method is performance critical and the Default implementation:
defaultSeekExact may be slow in some cases, so
+ * Subclass SHOULD have its own implementation if possible.
+ *
+ * @return true if the term is found; return false if the enum is
unpositioned.
+ */
+ public abstract boolean seekExact(BytesRef text) throws IOException;
+
+ /**
+ * Default implementation for seekExact(BytesRef), which may be slow in some
cases. <br>
+ * The abstract seekExact(BytesRef) method is performance critical, subclass
SHOULD have its own implementation if
+ * possible.
+ */
+ public final boolean defaultSeekExactImpl(BytesRef text) throws IOException {
Review comment:
I don't think we should do this. Lets just call `return seekCeil(text) ==
SeekStatus.FOUND;` in all the places.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]