Skip to content

Apache Lucene open-source search software

LUCENE-8242: Remove IndexSearcher.createNormalizedWeight

Alan Woodwarde30264b31400
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 9dfc17e082a..79b984a4ed6 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -38,6 +38,9 @@ API Changes
* LUCENE-8113: TermContext has been renamed to TermStates, and can now be
constructed lazily if term statistics are not required (Alan Woodward)
+* LUCENE-8242: Deprecated method IndexSearcher#createNormalizedWeight() has
+ been removed (Alan Woodward)
+
Changes in Runtime Behavior
* LUCENE-7837: Indices that were created before the previous major version
diff --git a/lucene/MIGRATE.txt b/lucene/MIGRATE.txt
index 575acdccb71..2825bcaced5 100644
--- a/lucene/MIGRATE.txt
+++ b/lucene/MIGRATE.txt
@@ -37,3 +37,9 @@ Changing index options on the fly is now going to result into an
IllegalArgumentException. If a field is indexed
(FieldType.indexOptions() != IndexOptions.NONE) then all documents must have
the same index options for that field.
+
+
+## IndexSearcher.createNormalizedWeight() removed (LUCENE-8242) ##
+
+Instead use IndexSearcher.createWeight(), rewriting the query first, and using
+a boost of 1f.
diff --git a/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java b/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java
index a9fcab3a319..5a3c890d271 100644
--- a/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java
+++ b/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java
@@ -679,22 +679,6 @@ public class IndexSearcher {
return weight.explain(ctx, deBasedDoc);
}
- /**
- * Creates a normalized weight for a top-level {@link Query}.
- * The query is rewritten by this method and {@link Query#createWeight} called,
- * afterwards the {@link Weight} is normalized. The returned {@code Weight}
- * can then directly be used to get a {@link Scorer}.
- * @lucene.internal
- *
- * @deprecated Clients should rewrite the query and then call {@link #createWeight(Query, ScoreMode, float)}
- * with a boost value of 1f
- */
- @Deprecated
- public Weight createNormalizedWeight(Query query, ScoreMode scoreMode) throws IOException {
- query = rewrite(query);
- return createWeight(query, scoreMode, 1f);
- }
-
/**
* Creates a {@link Weight} for the given query, potentially adding caching
* if possible and configured.