本文整理汇总了Java中org.apache.lucene.search.DocIdSetIterator.all方法的典型用法代码示例。如果您正苦于以下问题:Java DocIdSetIterator.all方法的具体用法?Java DocIdSetIterator.all怎么用?Java DocIdSetIterator.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.search.DocIdSetIterator
的用法示例。
在下文中一共展示了DocIdSetIterator.all方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createWeight
import org.apache.lucene.search.DocIdSetIterator; //导入方法依赖的package包/类
@Override
public Weight createWeight(IndexSearcher searcher, boolean needsScores) throws IOException {
if (!needsScores) {
// If scores are not needed simply return a constant score on all docs
return new ConstantScoreWeight(this) {
@Override
public Scorer scorer(LeafReaderContext context) throws IOException {
return new ConstantScoreScorer(this, score(), DocIdSetIterator.all(context.reader().maxDoc()));
}
};
}
List<Weight> weights = new ArrayList<>(queries.size());
for (Query q : queries) {
weights.add(searcher.createWeight(q, needsScores));
}
return new RankerWeight(weights);
}
示例2: iterateAllDocs
import org.apache.lucene.search.DocIdSetIterator; //导入方法依赖的package包/类
private DocIdSetIterator iterateAllDocs()
{
IndexReader reader = searcher.getIndexReader();
final Bits liveDocs = MultiFields.getLiveDocs( reader );
final DocIdSetIterator allDocs = DocIdSetIterator.all( reader.maxDoc() );
if ( liveDocs == null )
{
return allDocs;
}
return new FilteredDocIdSetIterator( allDocs )
{
@Override
protected boolean match( int doc )
{
return liveDocs.get( doc );
}
};
}
示例3: createWeight
import org.apache.lucene.search.DocIdSetIterator; //导入方法依赖的package包/类
@Override
public Weight createWeight(IndexSearcher searcher, boolean needsScores)
throws IOException {
return new ConstantScoreWeight(this) {
@Override
public Scorer scorer(LeafReaderContext context) throws IOException {
return new ConstantScoreScorer(this, score(), DocIdSetIterator.all(context.reader().maxDoc()));
}
};
}
示例4: createWeight
import org.apache.lucene.search.DocIdSetIterator; //导入方法依赖的package包/类
@Override
public Weight createWeight(IndexSearcher searcher, boolean needsScores) throws IOException {
if (!needsScores) {
// If scores are not needed simply return a constant score on all docs
return new ConstantScoreWeight(this) {
@Override
public Scorer scorer(LeafReaderContext context) throws IOException {
return new ConstantScoreScorer(this, score(), DocIdSetIterator.all(context.reader().maxDoc()));
}
};
}
return new FVWeight(this);
}
示例5: scorer
import org.apache.lucene.search.DocIdSetIterator; //导入方法依赖的package包/类
@Override
public Scorer scorer(LeafReaderContext context, Supplier<LtrRanker.FeatureVector> vectorSupplier) throws IOException {
Bindings bindings = new Bindings(){
@Override
public DoubleValuesSource getDoubleValuesSource(String name) {
return new FVDoubleValuesSource(vectorSupplier, features.featureOrdinal(name));
}
};
DocIdSetIterator iterator = DocIdSetIterator.all(context.reader().maxDoc());
DoubleValuesSource src = expression.getDoubleValuesSource(bindings);
DoubleValues values = src.getValues(context, null);
return new DValScorer(this, iterator, values);
}
示例6: scorer
import org.apache.lucene.search.DocIdSetIterator; //导入方法依赖的package包/类
private static Scorer scorer(int maxDoc, final int[] docs, final float[] scores, final boolean twoPhase) {
final DocIdSetIterator iterator = twoPhase ? DocIdSetIterator.all(maxDoc) : iterator(docs);
return new Scorer(null) {
public DocIdSetIterator iterator() {
if (twoPhase) {
return TwoPhaseIterator.asDocIdSetIterator(twoPhaseIterator());
} else {
return iterator;
}
}
public TwoPhaseIterator twoPhaseIterator() {
if (twoPhase) {
return new TwoPhaseIterator(iterator) {
@Override
public boolean matches() throws IOException {
return Arrays.binarySearch(docs, iterator.docID()) >= 0;
}
@Override
public float matchCost() {
return 10;
}
};
} else {
return null;
}
}
@Override
public int docID() {
return iterator.docID();
}
@Override
public float score() throws IOException {
final int idx = Arrays.binarySearch(docs, docID());
return scores[idx];
}
@Override
public int freq() throws IOException {
return 1;
}
};
}
示例7: createWeight
import org.apache.lucene.search.DocIdSetIterator; //导入方法依赖的package包/类
@Override
public Weight createWeight(IndexSearcher searcher, boolean needsScores) throws IOException {
final Weight boundingBoxWeight;
if (boundingBoxFilter != null) {
boundingBoxWeight = searcher.createNormalizedWeight(boundingBoxFilter, false);
} else {
boundingBoxWeight = null;
}
return new ConstantScoreWeight(this) {
@Override
public Scorer scorer(LeafReaderContext context) throws IOException {
final DocIdSetIterator approximation;
if (boundingBoxWeight != null) {
Scorer s = boundingBoxWeight.scorer(context);
if (s == null) {
// if the approximation does not match anything, we're done
return null;
}
approximation = s.iterator();
} else {
approximation = DocIdSetIterator.all(context.reader().maxDoc());
}
final MultiGeoPointValues values = indexFieldData.load(context).getGeoPointValues();
final TwoPhaseIterator twoPhaseIterator = new TwoPhaseIterator(approximation) {
@Override
public boolean matches() throws IOException {
final int doc = approximation.docID();
values.setDocument(doc);
final int length = values.count();
for (int i = 0; i < length; i++) {
GeoPoint point = values.valueAt(i);
if (distanceBoundingCheck.isWithin(point.lat(), point.lon())) {
double d = fixedSourceDistance.calculate(point.lat(), point.lon());
if (d >= inclusiveLowerPoint && d <= inclusiveUpperPoint) {
return true;
}
}
}
return false;
}
@Override
public float matchCost() {
if (distanceBoundingCheck == GeoDistance.ALWAYS_INSTANCE) {
return 0.0f;
} else {
// TODO: is this right (up to 4 comparisons from GeoDistance.SimpleDistanceBoundingCheck)?
return 4.0f;
}
}
};
return new ConstantScoreScorer(this, score(), twoPhaseIterator);
}
};
}
示例8: NoopScorer
import org.apache.lucene.search.DocIdSetIterator; //导入方法依赖的package包/类
/**
* Constructs a Scorer
*
* @param weight The scorers <code>Weight</code>.
*/
public NoopScorer(Weight weight, int maxDocs) {
super(weight);
_noopIter = DocIdSetIterator.all(maxDocs);
}