LUCENE-5487: throw OUE from FakeScorer.getWeight

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene5487@1576096 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2014-03-10 21:41:44 +00:00
parent e7acdf3129
commit d1ddcfa7c1
8 changed files with 44 additions and 3 deletions

View File

@ -153,6 +153,11 @@ final class BooleanScorer extends BulkScorer {
public long cost() {
throw new UnsupportedOperationException();
}
@Override
public Weight getWeight() {
throw new UnsupportedOperationException();
}
}
static final class Bucket {

View File

@ -805,6 +805,11 @@ public class IndexSearcher {
public long cost() {
return 1;
}
@Override
public Weight getWeight() {
throw new UnsupportedOperationException();
}
}
private final FakeScorer fakeScorer = new FakeScorer();

View File

@ -240,6 +240,11 @@ public class TestBooleanScorer extends LuceneTestCase {
public long cost() {
throw new UnsupportedOperationException();
}
@Override
public Weight getWeight() {
throw new UnsupportedOperationException();
}
}
/** Throws UOE if Weight.scorer is called */

View File

@ -661,6 +661,11 @@ class DrillSidewaysScorer extends BulkScorer {
public Collection<ChildScorer> getChildren() {
return Collections.singletonList(new ChildScorer(baseScorer, "MUST"));
}
@Override
public Weight getWeight() {
throw new UnsupportedOperationException();
}
}
static class DocsAndCost implements Comparable<DocsAndCost> {

View File

@ -22,8 +22,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.lucene.facet.FacetsCollector;
import org.apache.lucene.facet.FacetsCollector.MatchingDocs;
import org.apache.lucene.facet.FacetsCollector;
import org.apache.lucene.facet.FacetsConfig;
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.queries.function.FunctionValues;
@ -31,6 +31,7 @@ import org.apache.lucene.queries.function.ValueSource;
import org.apache.lucene.queries.function.docvalues.DoubleDocValues;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.Scorer;
import org.apache.lucene.search.Weight;
import org.apache.lucene.util.IntsRef;
/** Aggregates sum of values from {@link
@ -70,6 +71,11 @@ public class TaxonomyFacetSumValueSource extends FloatTaxonomyFacets {
@Override public int nextDoc() throws IOException { throw new UnsupportedOperationException(); }
@Override public int advance(int target) throws IOException { throw new UnsupportedOperationException(); }
@Override public long cost() { return 0; }
@Override
public Weight getWeight() {
throw new UnsupportedOperationException();
}
}
private final void sumValues(List<MatchingDocs> matchingDocs, boolean keepScores, ValueSource valueSource) throws IOException {

View File

@ -90,7 +90,7 @@ public class BlockGroupingCollector extends Collector {
int doc;
public FakeScorer() {
super((Weight) null);
super(null);
}
@Override
@ -122,6 +122,11 @@ public class BlockGroupingCollector extends Collector {
public long cost() {
return 1;
}
@Override
public Weight getWeight() {
throw new UnsupportedOperationException();
}
}
private static final class OneGroup {

View File

@ -242,6 +242,11 @@ class TermsIncludingScoreQuery extends Query {
public long cost() {
throw new UnsupportedOperationException();
}
@Override
public Weight getWeight() {
throw new UnsupportedOperationException();
}
}
// This impl assumes that the 'join' values are used uniquely per doc per field. Used for one to many relations.

View File

@ -331,7 +331,7 @@ public class ToParentBlockJoinCollector extends Collector {
int doc;
public FakeScorer() {
super((Weight) null);
super(null);
}
@Override
@ -363,6 +363,11 @@ public class ToParentBlockJoinCollector extends Collector {
public long cost() {
return 1;
}
@Override
public Weight getWeight() {
throw new UnsupportedOperationException();
}
}
private OneGroup[] sortedGroups;