Skip to content

Apache Lucene open-source search software

Deprecate Operations.complement() method (#15763)

Saurabh Singhcf3545b71cb4
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index b9c5727e39b..0f8daea1aee 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -8,6 +8,9 @@ http://s.apache.org/luceneversions
API Changes
---------------------
+* GITHUB#15763: Deprecate Operations.complement() method. This operation can be slow and is not
+ recommended for production use. It will be removed in Lucene 12. (Saurabh Singh)
+
* GITHUB#15755: Deprecate Operations.minus() method. This slow operation has been moved to
AutomatonTestUtil.minus() for testing purposes only. The method will be removed in Lucene 12.
(Saurabh Singh)
diff --git a/lucene/core/src/java/org/apache/lucene/util/automaton/Operations.java b/lucene/core/src/java/org/apache/lucene/util/automaton/Operations.java
index 65efa16a204..8c7185393f6 100644
--- a/lucene/core/src/java/org/apache/lucene/util/automaton/Operations.java
+++ b/lucene/core/src/java/org/apache/lucene/util/automaton/Operations.java
@@ -343,7 +343,10 @@ public final class Operations {
* @param determinizeWorkLimit maximum effort to spend determinizing the automaton. Set higher to
* allow more complex queries and lower to prevent memory exhaustion. {@link
* #DEFAULT_DETERMINIZE_WORK_LIMIT} is a good starting default.
+ * @deprecated This operation can be slow and is not recommended for production use. It will be
+ * removed in Lucene 12.
*/
+ @Deprecated
public static Automaton complement(Automaton a, int determinizeWorkLimit) {
a = totalize(determinize(a, determinizeWorkLimit));
int numStates = a.getNumStates();