Merge "Lucene: Support for "assignee:", "is:unassigned" search operators"

This commit is contained in:
David Pursehouse
2016-09-21 19:54:23 +00:00
committed by Gerrit Code Review
6 changed files with 99 additions and 2 deletions

View File

@@ -74,6 +74,8 @@ import java.util.Set;
* characters.
*/
public class ChangeField {
public static final int NO_ASSIGNEE = -1;
/** Legacy change ID. */
public static final FieldDef<ChangeData, Integer> LEGACY_ID =
new FieldDef.Single<ChangeData, Integer>("legacy_id",
@@ -314,6 +316,18 @@ public class ChangeField {
}
};
/** The user assigned to the change. */
public static final FieldDef<ChangeData, Integer> ASSIGNEE =
new FieldDef.Single<ChangeData, Integer>(
ChangeQueryBuilder.FIELD_ASSIGNEE, FieldType.INTEGER, true) {
@Override
public Integer get(ChangeData input, FillArgs args)
throws OrmException {
Account.Id id = input.assignee();
return id != null ? id.get() : NO_ASSIGNEE;
}
};
/** Reviewer(s) associated with the change. */
public static final FieldDef<ChangeData, Iterable<String>> REVIEWER =
new FieldDef.Repeatable<ChangeData, String>(

View File

@@ -81,13 +81,17 @@ public class ChangeSchemaDefinitions extends SchemaDefinitions<ChangeData> {
.remove(ChangeField.STARREDBY)
.build();
@SuppressWarnings("deprecation")
@Deprecated
static final Schema<ChangeData> V32 = new Schema.Builder<ChangeData>()
.add(V31)
.remove(ChangeField.LEGACY_REVIEWER)
.add(ChangeField.REVIEWER)
.build();
@SuppressWarnings("deprecation")
static final Schema<ChangeData> V33 =
schema(V32, ChangeField.ASSIGNEE);
public static final String NAME = "changes";
public static final ChangeSchemaDefinitions INSTANCE =
new ChangeSchemaDefinitions();