Search project, branch, ref with ChangeIndex
Index changes by project and reference in the secondary index. The branch operator is derived from the RefPredicate. Only the exact match operators are supported. Regex operators fall back to database scans. Change-Id: I2fc09bb2af2df9d0c911d804d8f8fd6fe617a804
This commit is contained in:
@@ -38,7 +38,7 @@ import java.util.Map;
|
||||
*/
|
||||
public class ChangeField {
|
||||
/** Increment whenever making schema changes. */
|
||||
public static final int SCHEMA_VERSION = 1;
|
||||
public static final int SCHEMA_VERSION = 2;
|
||||
|
||||
/** Legacy change ID. */
|
||||
public static final FieldDef<ChangeData, Integer> CHANGE_ID =
|
||||
@@ -62,6 +62,28 @@ public class ChangeField {
|
||||
}
|
||||
};
|
||||
|
||||
/** Project containing the change. */
|
||||
public static final FieldDef<ChangeData, String> PROJECT =
|
||||
new FieldDef.Single<ChangeData, String>(
|
||||
ChangeQueryBuilder.FIELD_PROJECT, FieldType.EXACT, false) {
|
||||
@Override
|
||||
public String get(ChangeData input, FillArgs args)
|
||||
throws OrmException {
|
||||
return input.change(args.db).getProject().get();
|
||||
}
|
||||
};
|
||||
|
||||
/** Reference (aka branch) the change will submit onto. */
|
||||
public static final FieldDef<ChangeData, String> REF =
|
||||
new FieldDef.Single<ChangeData, String>(
|
||||
ChangeQueryBuilder.FIELD_REF, FieldType.EXACT, false) {
|
||||
@Override
|
||||
public String get(ChangeData input, FillArgs args)
|
||||
throws OrmException {
|
||||
return input.change(args.db).getDest().get();
|
||||
}
|
||||
};
|
||||
|
||||
/** List of filenames modified in the current patch set. */
|
||||
public static final FieldDef<ChangeData, Iterable<String>> FILE =
|
||||
new FieldDef.Repeatable<ChangeData, String>(
|
||||
|
Reference in New Issue
Block a user