use of com.apple.foundationdb.record.query.plan.plans.RecordQueryScoreForRankPlan in project fdb-record-layer by FoundationDB.
the class RankComparisons method wrap.
@Nonnull
public RecordQueryPlan wrap(@Nonnull RecordQueryPlan plan, @Nullable Set<RankComparison> includedRankComparisons, @Nonnull RecordMetaData metaData) {
if (comparisons.isEmpty()) {
return plan;
}
List<RecordQueryScoreForRankPlan.ScoreForRank> ranks = new ArrayList<>(comparisons.size());
for (RankComparison rankComparison : comparisons.values()) {
if (includedRankComparisons != null && includedRankComparisons.contains(rankComparison)) {
continue;
}
ranks.add(rankComparison.getScoreForRank(metaData));
}
if (!ranks.isEmpty()) {
// Make exact plan deterministic.
Collections.sort(ranks, Comparator.comparing(RecordQueryScoreForRankPlan.ScoreForRank::getBindingName));
plan = new RecordQueryScoreForRankPlan(plan, ranks);
}
return plan;
}
Aggregations