You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ja...@apache.org on 2023/05/09 09:30:09 UTC

[lucene] branch branch_9x updated (f074dc9ac42 -> 447cfea993d)

This is an automated email from the ASF dual-hosted git repository.

javanna pushed a change to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git


    from f074dc9ac42 Add missing author to changelog entry for #12220
     new 3e6ab767518 Make query timeout members final in ExitableDirectoryReader (#12274)
     new 48986d17d12 Update javadocs for QueryTimeout (#12272)
     new 447cfea993d Make TimeExceededException members final (#12271)

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/lucene/index/ExitableDirectoryReader.java    |  6 +++---
 .../core/src/java/org/apache/lucene/index/QueryTimeout.java | 13 ++++++++-----
 .../org/apache/lucene/search/TimeLimitingCollector.java     |  6 +++---
 3 files changed, 14 insertions(+), 11 deletions(-)


[lucene] 01/03: Make query timeout members final in ExitableDirectoryReader (#12274)

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

javanna pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git

commit 3e6ab76751888ffdd4f29db14ddcc6d67714f095
Author: Luca Cavanna <ja...@apache.org>
AuthorDate: Tue May 9 11:27:06 2023 +0200

    Make query timeout members final in ExitableDirectoryReader (#12274)
    
    There's a couple of places in the Exitable wrapper classes where
    queryTimeout is set within the constructor and never modified. This
    commit makes such members final.
---
 .../src/java/org/apache/lucene/index/ExitableDirectoryReader.java   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lucene/core/src/java/org/apache/lucene/index/ExitableDirectoryReader.java b/lucene/core/src/java/org/apache/lucene/index/ExitableDirectoryReader.java
index b180d3bdda3..a572b2258af 100644
--- a/lucene/core/src/java/org/apache/lucene/index/ExitableDirectoryReader.java
+++ b/lucene/core/src/java/org/apache/lucene/index/ExitableDirectoryReader.java
@@ -36,7 +36,7 @@ import org.apache.lucene.util.automaton.CompiledAutomaton;
  */
 public class ExitableDirectoryReader extends FilterDirectoryReader {
 
-  private QueryTimeout queryTimeout;
+  private final QueryTimeout queryTimeout;
 
   /** Exception that is thrown to prematurely terminate a term enumeration. */
   @SuppressWarnings("serial")
@@ -50,7 +50,7 @@ public class ExitableDirectoryReader extends FilterDirectoryReader {
 
   /** Wrapper class for a SubReaderWrapper that is used by the ExitableDirectoryReader. */
   public static class ExitableSubReaderWrapper extends SubReaderWrapper {
-    private QueryTimeout queryTimeout;
+    private final QueryTimeout queryTimeout;
 
     /** Constructor * */
     public ExitableSubReaderWrapper(QueryTimeout queryTimeout) {
@@ -810,7 +810,7 @@ public class ExitableDirectoryReader extends FilterDirectoryReader {
     // Create bit mask in the form of 0000 1111 for efficient checking
     private static final int NUM_CALLS_PER_TIMEOUT_CHECK = (1 << 4) - 1; // 15
     private int calls;
-    private QueryTimeout queryTimeout;
+    private final QueryTimeout queryTimeout;
 
     /** Constructor * */
     public ExitableTermsEnum(TermsEnum termsEnum, QueryTimeout queryTimeout) {


[lucene] 03/03: Make TimeExceededException members final (#12271)

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

javanna pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git

commit 447cfea993db09446d569f0339b3bd630e140907
Author: Luca Cavanna <ja...@apache.org>
AuthorDate: Tue May 9 11:28:23 2023 +0200

    Make TimeExceededException members final (#12271)
    
    TimeExceededException has three members that are set within its constructor and never modified. They can be made final.
---
 .../src/java/org/apache/lucene/search/TimeLimitingCollector.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lucene/core/src/java/org/apache/lucene/search/TimeLimitingCollector.java b/lucene/core/src/java/org/apache/lucene/search/TimeLimitingCollector.java
index 4a208a3f0c5..c50f3a372e9 100644
--- a/lucene/core/src/java/org/apache/lucene/search/TimeLimitingCollector.java
+++ b/lucene/core/src/java/org/apache/lucene/search/TimeLimitingCollector.java
@@ -33,9 +33,9 @@ public class TimeLimitingCollector implements Collector {
   /** Thrown when elapsed search time exceeds allowed search time. */
   @SuppressWarnings("serial")
   public static class TimeExceededException extends RuntimeException {
-    private long timeAllowed;
-    private long timeElapsed;
-    private int lastDocCollected;
+    private final long timeAllowed;
+    private final long timeElapsed;
+    private final int lastDocCollected;
 
     private TimeExceededException(long timeAllowed, long timeElapsed, int lastDocCollected) {
       super(


[lucene] 02/03: Update javadocs for QueryTimeout (#12272)

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

javanna pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git

commit 48986d17d1205dcef46fa1e3098e4223327cb665
Author: Luca Cavanna <ja...@apache.org>
AuthorDate: Tue May 9 11:27:47 2023 +0200

    Update javadocs for QueryTimeout (#12272)
    
    QueryTimeout was introduced together with ExitableDirectoryReader but is
    now also optionally set to the IndexSearcher to wrap the bulk scorer
    with a TimeLimitingBulkScorer. Its javadocs needs updating.
---
 .../core/src/java/org/apache/lucene/index/QueryTimeout.java | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lucene/core/src/java/org/apache/lucene/index/QueryTimeout.java b/lucene/core/src/java/org/apache/lucene/index/QueryTimeout.java
index 0c64f4c2c9a..f1e54342367 100644
--- a/lucene/core/src/java/org/apache/lucene/index/QueryTimeout.java
+++ b/lucene/core/src/java/org/apache/lucene/index/QueryTimeout.java
@@ -17,14 +17,17 @@
 package org.apache.lucene.index;
 
 /**
- * Base for query timeout implementations, which will provide a {@code shouldExit()} method, used
- * with {@link ExitableDirectoryReader}.
+ * Query timeout abstraction that controls whether a query should continue or be stopped. Can be set
+ * to the searcher through {@link org.apache.lucene.search.IndexSearcher#setTimeout(QueryTimeout)},
+ * in which case bulk scoring will be time-bound. Can also be used in combination with {@link
+ * ExitableDirectoryReader}.
  */
 public interface QueryTimeout {
 
   /**
-   * Called from {@link ExitableDirectoryReader.ExitableTermsEnum#next()} to determine whether to
-   * stop processing a query.
+   * Called to determine whether to stop processing a query
+   *
+   * @return true if the query should stop, false otherwise
    */
-  public abstract boolean shouldExit();
+  boolean shouldExit();
 }