lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] jefferyyuan commented on a change in pull request #551: LUCENE-8662: Change TermsEnum.seekExact(BytesRef) to abstract
Date Thu, 31 Jan 2019 19:01:33 GMT
jefferyyuan commented on a change in pull request #551: LUCENE-8662: Change TermsEnum.seekExact(BytesRef)
to abstract
URL: https://github.com/apache/lucene-solr/pull/551#discussion_r252797675
 
 

 ##########
 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:
   Thanks @s1monw @dsmiley and changed the code based on your suggestions : )

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message