Support 'comment' query operator to search for inline/summary comments
Change-Id: I9b073cbb6acc90aac3165643ca36ae5ff6fc7fdc Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -18,6 +18,8 @@ import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.ChangeMessage;
|
||||
import com.google.gerrit.reviewdb.client.PatchLineComment;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gerrit.reviewdb.client.PatchSetApproval;
|
||||
import com.google.gerrit.reviewdb.client.TrackingId;
|
||||
@@ -47,7 +49,7 @@ import java.util.Set;
|
||||
*/
|
||||
public class ChangeField {
|
||||
/** Increment whenever making schema changes. */
|
||||
public static final int SCHEMA_VERSION = 12;
|
||||
public static final int SCHEMA_VERSION = 13;
|
||||
|
||||
/** Legacy change ID. */
|
||||
public static final FieldDef<ChangeData, Integer> LEGACY_ID =
|
||||
@@ -249,6 +251,24 @@ public class ChangeField {
|
||||
}
|
||||
};
|
||||
|
||||
/** Summary or inline comment. */
|
||||
public static final FieldDef<ChangeData, Iterable<String>> COMMENT =
|
||||
new FieldDef.Repeatable<ChangeData, String>(ChangeQueryBuilder.FIELD_COMMENT,
|
||||
FieldType.FULL_TEXT, false) {
|
||||
@Override
|
||||
public Iterable<String> get(ChangeData input, FillArgs args)
|
||||
throws OrmException {
|
||||
Set<String> r = Sets.newHashSet();
|
||||
for (PatchLineComment c : input.comments(args.db)) {
|
||||
r.add(c.getMessage());
|
||||
}
|
||||
for (ChangeMessage m : input.messages(args.db)) {
|
||||
r.add(m.getMessage());
|
||||
}
|
||||
return r;
|
||||
}
|
||||
};
|
||||
|
||||
public static final ImmutableMap<String, FieldDef<ChangeData, ?>> ALL;
|
||||
|
||||
static {
|
||||
|
||||
Reference in New Issue
Block a user