Print proper name for QuerySource tasks in show-queue command
Before this commit, the tasks name were printed like this: com.google.gerrit.lucene.LuceneChangeIndex$QuerySource$1@77352d29 Now, the Lucene query is printed, example: ((status:new OR status:draft) owner:1000001) Change-Id: I9a08a8eef08af5dba9b0948b9ae445a807fe8b87
This commit is contained in:
@@ -367,8 +367,7 @@ public class LuceneChangeIndex implements ChangeIndex {
|
|||||||
if (!Sets.intersection(statuses, CLOSED_STATUSES).isEmpty()) {
|
if (!Sets.intersection(statuses, CLOSED_STATUSES).isEmpty()) {
|
||||||
indexes.add(closedIndex);
|
indexes.add(closedIndex);
|
||||||
}
|
}
|
||||||
return new QuerySource(indexes, queryBuilder.toQuery(p), opts,
|
return new QuerySource(indexes, p, opts, getSort());
|
||||||
getSort());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -401,14 +400,18 @@ public class LuceneChangeIndex implements ChangeIndex {
|
|||||||
|
|
||||||
private class QuerySource implements ChangeDataSource {
|
private class QuerySource implements ChangeDataSource {
|
||||||
private final List<SubIndex> indexes;
|
private final List<SubIndex> indexes;
|
||||||
|
private final Predicate<ChangeData> predicate;
|
||||||
private final Query query;
|
private final Query query;
|
||||||
private final QueryOptions opts;
|
private final QueryOptions opts;
|
||||||
private final Sort sort;
|
private final Sort sort;
|
||||||
|
|
||||||
private QuerySource(List<SubIndex> indexes, Query query, QueryOptions opts,
|
|
||||||
Sort sort) {
|
private QuerySource(List<SubIndex> indexes, Predicate<ChangeData> predicate,
|
||||||
|
QueryOptions opts, Sort sort) throws QueryParseException {
|
||||||
this.indexes = indexes;
|
this.indexes = indexes;
|
||||||
this.query = checkNotNull(query, "null query from Lucene");
|
this.predicate = predicate;
|
||||||
|
this.query = checkNotNull(queryBuilder.toQuery(predicate),
|
||||||
|
"null query from Lucene");
|
||||||
this.opts = opts;
|
this.opts = opts;
|
||||||
this.sort = sort;
|
this.sort = sort;
|
||||||
}
|
}
|
||||||
@@ -425,7 +428,7 @@ public class LuceneChangeIndex implements ChangeIndex {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return query.toString();
|
return predicate.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -440,6 +443,11 @@ public class LuceneChangeIndex implements ChangeIndex {
|
|||||||
public List<Document> call() throws OrmException {
|
public List<Document> call() throws OrmException {
|
||||||
return doRead();
|
return doRead();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return predicate.toString();
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user