Index change status in the secondary index

Change-Id: I4dd8a815c1886be4e955267b0d9d2e23d0e41a4b
This commit is contained in:
Dave Borowitz
2013-05-22 16:52:25 -07:00
parent 74517e1b8b
commit 60ac9201ca
12 changed files with 97 additions and 31 deletions

View File

@@ -18,6 +18,7 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import com.google.gerrit.server.query.change.ChangeData;
import com.google.gerrit.server.query.change.ChangeQueryBuilder;
import com.google.gerrit.server.query.change.ChangeStatusPredicate;
import com.google.gwtorm.server.OrmException;
import java.lang.reflect.Field;
@@ -49,6 +50,18 @@ public class ChangeField {
}
};
/** Change status string, in the same format as {@code status:}. */
public static final FieldDef<ChangeData, String> STATUS =
new FieldDef.Single<ChangeData, String>(ChangeQueryBuilder.FIELD_STATUS,
FieldType.EXACT, false) {
@Override
public String get(ChangeData input, FillArgs args)
throws OrmException {
return ChangeStatusPredicate.VALUES.get(
input.change(args.db).getStatus());
}
};
/** List of filenames modified in the current patch set. */
public static final FieldDef<ChangeData, Iterable<String>> FILE =
new FieldDef.Repeatable<ChangeData, String>(