Class IsSubmittablePredicate
- java.lang.Object
- 
- com.google.gerrit.index.query.Predicate<T>
- 
- com.google.gerrit.index.query.OperatorPredicate<I>
- 
- com.google.gerrit.index.query.IndexPredicate<ChangeData>
- 
- com.google.gerrit.server.query.change.ChangeIndexPredicate
- 
- com.google.gerrit.server.query.change.BooleanPredicate
- 
- com.google.gerrit.server.query.change.IsSubmittablePredicate
 
 
 
 
 
 
- 
- All Implemented Interfaces:
- Matchable<ChangeData>
 
 public class IsSubmittablePredicate extends BooleanPredicate 
- 
- 
Field Summary- 
Fields inherited from class com.google.gerrit.index.query.OperatorPredicatename, value
 
- 
 - 
Constructor SummaryConstructors Constructor Description IsSubmittablePredicate()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static Predicate<ChangeData>rewrite(Predicate<ChangeData> in)Rewrite the is:submittable predicate.- 
Methods inherited from class com.google.gerrit.server.query.change.BooleanPredicatematch
 - 
Methods inherited from class com.google.gerrit.server.query.change.ChangeIndexPredicatenone
 - 
Methods inherited from class com.google.gerrit.index.query.IndexPredicategetCost, getField, getType
 - 
Methods inherited from class com.google.gerrit.index.query.OperatorPredicatecopy, equals, getOperator, getValue, hashCode, toString
 - 
Methods inherited from class com.google.gerrit.index.query.Predicateand, and, any, asMatchable, estimateCost, getChild, getChildCount, getChildren, getFlattenedPredicateList, getLeafCount, getPredicateString, isLeaf, isMatchable, not, or, or, supportedForQueries
 
- 
 
- 
- 
- 
Method Detail- 
rewritepublic static Predicate<ChangeData> rewrite(Predicate<ChangeData> in) Rewrite the is:submittable predicate.If we run a query with "is:submittable OR -is:submittable" the result should match all changes. In Lucene, we keep separate sub-indexes for open and closed changes. The Lucene backend inspects the input predicate and depending on all its child predicates decides if the query should run against the open sub-index, closed sub-index or both. The "is:submittable" operator is implemented as: issubmittable:1 But we want to exclude closed changes from being matched by this query. For the normal case, we rewrite the query as: issubmittable:1 AND status:new Hence Lucene will match the query against the open sub-index. For the negated case (i.e. "-is:submittable"), we cannot just negate the previous query because it would result in: -(issubmittable:1 AND status:new) Lucene will conclude that it should look for changes that are not new and hence will run the query against the closed sub-index, not matching with changes that are open but not submittable. For this case, we need to rewrite the query to match with closed changes or changes that are not submittable. 
 
- 
 
-