Skip to content

Apache Lucene open-source search software

LUCENE-8407: Add SpanTermQuery.getTermStates getter

David Smileyeafc9ffc6f90
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index ed162b21863..7697cb7e7e2 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -29,7 +29,7 @@ API Changes
* LUCENE-8099: CustomScoreQuery, BoostedQuery and BoostingQuery have been
removed (Alan Woodward)
-* LUCENE-8012: Explanation now takes Number rather than float (Alan Woodward,
+* LUCENE-8012: Explanation now takes Number rather than float (Alan Woodward,
Robert Muir)
* LUCENE-8116: SimScorer now only takes a frequency and a norm as per-document
@@ -142,6 +142,8 @@ API Changes:
* LUCENE-8379: Add experimental TermQuery.getTermStates method (Mike McCandless)
+* LUCENE-8407: Add experimental SpanTermQuery.getTermStates method (David Smiley)
+
* LUCENE-8390: MatchesIteratorSupplier replaced by IOSupplier (Alan Woodward,
David Smiley)
diff --git a/lucene/core/src/java/org/apache/lucene/search/spans/SpanTermQuery.java b/lucene/core/src/java/org/apache/lucene/search/spans/SpanTermQuery.java
index 9ac7afb81ee..42e73f2be2d 100644
--- a/lucene/core/src/java/org/apache/lucene/search/spans/SpanTermQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/search/spans/SpanTermQuery.java
@@ -61,6 +61,13 @@ public class SpanTermQuery extends SpanQuery {
/** Return the term whose spans are matched. */
public Term getTerm() { return term; }
+ /** Returns the {@link TermStates} passed to the constructor, or null if it was not passed.
+ *
+ * @lucene.experimental */
+ public TermStates getTermStates() {
+ return termStates;
+ }
+
@Override
public String getField() { return term.field(); }