use deletion aware constant score query

This commit is contained in:
kimchy 2010-06-10 15:04:36 +03:00
parent 668e84a99e
commit 5205a183e8
3 changed files with 5 additions and 3 deletions

View File

@ -212,8 +212,8 @@ public class DeletionAwareConstantScoreQuery extends Query {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof ConstantScoreQuery)) return false;
ConstantScoreQuery other = (ConstantScoreQuery) o;
if (!(o instanceof DeletionAwareConstantScoreQuery)) return false;
DeletionAwareConstantScoreQuery other = (DeletionAwareConstantScoreQuery) o;
return this.getBoost() == other.getBoost() && filter.equals(other.filter);
}

View File

@ -75,6 +75,8 @@ public class CustomFieldQuery extends FieldQuery {
}
} else if (sourceQuery instanceof ConstantScoreQuery) {
flatten(((ConstantScoreQuery) sourceQuery).getFilter(), flatQueries);
} else if (sourceQuery instanceof DeletionAwareConstantScoreQuery) {
flatten(((DeletionAwareConstantScoreQuery) sourceQuery).getFilter(), flatQueries);
} else if (sourceQuery instanceof CustomBoostFactorQuery) {
flatten(((CustomBoostFactorQuery) sourceQuery).getSubQuery(), flatQueries);
} else if (sourceQuery instanceof MultiTermQuery) {

View File

@ -61,7 +61,7 @@ public class FacetsPhase implements SearchPhase {
// run global facets ...
if (context.searcher().globalCollectors() != null) {
Query query = new ConstantScoreQuery(context.filterCache().cache(Queries.MATCH_ALL_FILTER));
Query query = new DeletionAwareConstantScoreQuery(context.filterCache().cache(Queries.MATCH_ALL_FILTER));
if (context.types().length > 0) {
if (context.types().length == 1) {
String type = context.types()[0];