Exactly index sortkey with Lucene
Store sortkey as a long and implement the before and after operators as numeric range queries. This is a short-term hack until we have a better idea of how to handle pagination without relying on a made up string value stored on the change object. Change-Id: Ibf7a8be281da8cd9e7ccc08bba600bbc2e0e962c
This commit is contained in:
@@ -19,6 +19,7 @@ import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.gerrit.reviewdb.client.PatchSetApproval;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gerrit.server.ChangeUtil;
|
||||
import com.google.gerrit.server.query.change.ChangeData;
|
||||
import com.google.gerrit.server.query.change.ChangeQueryBuilder;
|
||||
import com.google.gerrit.server.query.change.ChangeStatusPredicate;
|
||||
@@ -43,7 +44,7 @@ import java.util.Set;
|
||||
*/
|
||||
public class ChangeField {
|
||||
/** Increment whenever making schema changes. */
|
||||
public static final int SCHEMA_VERSION = 5;
|
||||
public static final int SCHEMA_VERSION = 6;
|
||||
|
||||
/** Legacy change ID. */
|
||||
public static final FieldDef<ChangeData, Integer> CHANGE_ID =
|
||||
@@ -111,6 +112,18 @@ public class ChangeField {
|
||||
}
|
||||
};
|
||||
|
||||
/** Sort key field, duplicates {@link #UPDATED}. */
|
||||
@Deprecated
|
||||
public static final FieldDef<ChangeData, Long> SORTKEY =
|
||||
new FieldDef.Single<ChangeData, Long>(
|
||||
"sortkey", FieldType.LONG, true) {
|
||||
@Override
|
||||
public Long get(ChangeData input, FillArgs args)
|
||||
throws OrmException {
|
||||
return ChangeUtil.parseSortKey(input.change(args.db).getSortKey());
|
||||
}
|
||||
};
|
||||
|
||||
/** 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