LUCENE-6981: SpanQuery.getTermContexts() helper methods should be public

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1725710 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Alan Woodward 2016-01-20 12:54:57 +00:00
parent 16c53a0fea
commit d66dd2f9f0
3 changed files with 15 additions and 7 deletions

View File

@ -152,6 +152,9 @@ API Changes
* LUCENE-6980: Default applyAllDeletes to true when opening
near-real-time readers (Mike McCandless)
* LUCENE-6981: SpanQuery.getTermContexts() helper methods are now public, and
SpanScorer has a public getSpans() method. (Alan Woodward)
Optimizations
* LUCENE-6951: Improve GeoPointInPolygonQuery using point orientation based

View File

@ -17,16 +17,16 @@ package org.apache.lucene.search.spans;
* limitations under the License.
*/
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermContext;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import java.io.IOException;
import java.util.Collection;
import java.util.Map;
import java.util.TreeMap;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermContext;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
/** Base class for span-based queries. */
public abstract class SpanQuery extends Query {
@ -42,7 +42,7 @@ public abstract class SpanQuery extends Query {
* Build a map of terms to termcontexts, for use in constructing SpanWeights
* @lucene.internal
*/
protected static Map<Term, TermContext> getTermContexts(SpanWeight... weights) {
public static Map<Term, TermContext> getTermContexts(SpanWeight... weights) {
Map<Term, TermContext> terms = new TreeMap<>();
for (SpanWeight w : weights) {
w.extractTermContexts(terms);
@ -54,7 +54,7 @@ public abstract class SpanQuery extends Query {
* Build a map of terms to termcontexts, for use in constructing SpanWeights
* @lucene.internal
*/
protected static Map<Term, TermContext> getTermContexts(Collection<SpanWeight> weights) {
public static Map<Term, TermContext> getTermContexts(Collection<SpanWeight> weights) {
Map<Term, TermContext> terms = new TreeMap<>();
for (SpanWeight w : weights) {
w.extractTermContexts(terms);

View File

@ -47,6 +47,11 @@ public class SpanScorer extends Scorer {
this.docScorer = docScorer;
}
/** return the Spans for this Scorer **/
public Spans getSpans() {
return spans;
}
@Override
public int docID() {
return spans.docID();