Rename "topic:" to "intopic:" and "exacttopic:" to "topic:"
"Exact topic" is unwieldy to say/type. We wanted to get the change that introduced it in faster so we could fix the correctness issue with submitWholeTopic and get the schema upgrade process started. Now we can go back and change the names to something more sensible. The new name "intopic" is shorter and parallels the standard Google search operator "inurl". Change-Id: Ic7a41947392f24752a5524ad8365c0453c931a8b
This commit is contained in:
@@ -153,8 +153,8 @@ expression patterns. The
|
||||
link:http://www.brics.dk/automaton/[dk.brics.automaton
|
||||
library] is used for evaluation of such patterns.
|
||||
|
||||
[[topic]]
|
||||
topic:'TOPIC'::
|
||||
[[intopic]]
|
||||
intopic:'TOPIC'::
|
||||
+
|
||||
Changes whose designated topic contains 'TOPIC', using a full-text search.
|
||||
+
|
||||
@@ -163,8 +163,8 @@ expression patterns. The
|
||||
link:http://www.brics.dk/automaton/[dk.brics.automaton
|
||||
library] is used for evaluation of such patterns.
|
||||
|
||||
[[exacttopic]]
|
||||
exacttopic:'TOPIC'::
|
||||
[[topic]]
|
||||
topic:'TOPIC'::
|
||||
+
|
||||
Changes whose designated topic matches 'TOPIC' exactly. This is
|
||||
often combined with 'branch:' and 'project:' operators to select
|
||||
|
@@ -85,6 +85,7 @@ public class SearchSuggestOracle extends HighlightSuggestOracle {
|
||||
suggestions.add("parentproject:");
|
||||
suggestions.add("branch:");
|
||||
suggestions.add("topic:");
|
||||
suggestions.add("intopic:");
|
||||
suggestions.add("ref:");
|
||||
suggestions.add("tr:");
|
||||
suggestions.add("bug:");
|
||||
|
@@ -200,7 +200,7 @@ public class RelatedChanges extends TabPanel {
|
||||
if (info.topic() != null && !"".equals(info.topic())) {
|
||||
StringBuilder topicQuery = new StringBuilder();
|
||||
topicQuery.append("status:open");
|
||||
topicQuery.append(" ").append(op("exacttopic", info.topic()));
|
||||
topicQuery.append(" ").append(op("topic", info.topic()));
|
||||
ChangeList.query(topicQuery.toString(),
|
||||
EnumSet.of(ListChangesOption.CURRENT_REVISION,
|
||||
ListChangesOption.CURRENT_COMMIT,
|
||||
|
@@ -86,7 +86,7 @@ class Topic extends Composite {
|
||||
text.setText(info.topic());
|
||||
text.setTargetHistoryToken(
|
||||
PageLinks.toChangeQuery(
|
||||
PageLinks.op("exacttopic", info.topic())));
|
||||
PageLinks.op("topic", info.topic())));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -76,7 +76,7 @@ public class BranchLink extends InlineHyperlink {
|
||||
}
|
||||
|
||||
if (topic != null && !topic.isEmpty()) {
|
||||
query += " " + PageLinks.op("exacttopic", topic);
|
||||
query += " " + PageLinks.op("topic", topic);
|
||||
}
|
||||
|
||||
return query;
|
||||
|
@@ -67,7 +67,7 @@ public class GetRevisionActions implements ETagView<RevisionResource> {
|
||||
Hasher h = Hashing.md5().newHasher();
|
||||
CurrentUser user = rsrc.getControl().getCurrentUser();
|
||||
try {
|
||||
for (ChangeData c : queryProvider.get().byExactTopicOpen(topic)) {
|
||||
for (ChangeData c : queryProvider.get().byTopicOpen(topic)) {
|
||||
new ChangeResource(c.changeControl(), rebaseChange).prepareETag(h, user);
|
||||
}
|
||||
} catch (OrmException e){
|
||||
|
@@ -697,7 +697,7 @@ public class Submit implements RestModifyView<RevisionResource, SubmitInput>,
|
||||
|
||||
private List<ChangeData> getChangesByTopic(String topic) {
|
||||
try {
|
||||
return queryProvider.get().byExactTopicOpen(topic);
|
||||
return queryProvider.get().byTopicOpen(topic);
|
||||
} catch (OrmException e) {
|
||||
throw new OrmRuntimeException(e);
|
||||
}
|
||||
|
@@ -478,19 +478,19 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> exacttopic(String name) {
|
||||
public Predicate<ChangeData> topic(String name) {
|
||||
return new ExactTopicPredicate(args.getSchema(), name);
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> topic(String name) {
|
||||
public Predicate<ChangeData> intopic(String name) {
|
||||
if (name.startsWith("^")) {
|
||||
return new RegexTopicPredicate(args.getSchema(), name);
|
||||
}
|
||||
if (name.isEmpty()) {
|
||||
return new ExactTopicPredicate(args.getSchema(), name);
|
||||
}
|
||||
return new TopicPredicate(args.getSchema(), name, args.index);
|
||||
return new FuzzyTopicPredicate(args.getSchema(), name, args.index);
|
||||
}
|
||||
|
||||
@Operator
|
||||
|
@@ -28,7 +28,7 @@ import com.google.gerrit.server.query.Predicate;
|
||||
import com.google.gerrit.server.query.QueryParseException;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
|
||||
class TopicPredicate extends IndexPredicate<ChangeData> {
|
||||
class FuzzyTopicPredicate extends IndexPredicate<ChangeData> {
|
||||
private final ChangeIndex index;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@@ -36,7 +36,8 @@ class TopicPredicate extends IndexPredicate<ChangeData> {
|
||||
return schema.getField(FUZZY_TOPIC, LEGACY_TOPIC3, LEGACY_TOPIC2).get();
|
||||
}
|
||||
|
||||
TopicPredicate(Schema<ChangeData> schema, String topic, ChangeIndex index) {
|
||||
FuzzyTopicPredicate(Schema<ChangeData> schema, String topic,
|
||||
ChangeIndex index) {
|
||||
super(topicField(schema), topic);
|
||||
this.index = index;
|
||||
}
|
@@ -131,7 +131,7 @@ public class InternalChangeQuery {
|
||||
return query(and(project(project), open()));
|
||||
}
|
||||
|
||||
public List<ChangeData> byExactTopicOpen(String topic)
|
||||
public List<ChangeData> byTopicOpen(String topic)
|
||||
throws OrmException {
|
||||
return query(and(new ExactTopicPredicate(schema(indexes), topic), open()));
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ class RegexTopicPredicate extends RegexPredicate<ChangeData> {
|
||||
private final RunAutomaton pattern;
|
||||
|
||||
RegexTopicPredicate(Schema<ChangeData> schema, String re) {
|
||||
super(TopicPredicate.topicField(schema), re);
|
||||
super(FuzzyTopicPredicate.topicField(schema), re);
|
||||
|
||||
if (re.startsWith("^")) {
|
||||
re = re.substring(1);
|
||||
|
@@ -453,14 +453,14 @@ public abstract class AbstractQueryChangesTest {
|
||||
|
||||
Change change5 = newChange(repo, null, null, null, null).insert();
|
||||
|
||||
assertQuery("topic:foo");
|
||||
assertQuery("topic:feature1", change1);
|
||||
assertQuery("topic:feature2", change4, change3, change2);
|
||||
assertQuery("exacttopic:feature2", change2);
|
||||
assertQuery("topic:feature2", change4, change3, change2);
|
||||
assertQuery("topic:fixup", change4);
|
||||
assertQuery("exacttopic:\"\"", change5);
|
||||
assertQuery("intopic:foo");
|
||||
assertQuery("intopic:feature1", change1);
|
||||
assertQuery("intopic:feature2", change4, change3, change2);
|
||||
assertQuery("topic:feature2", change2);
|
||||
assertQuery("intopic:feature2", change4, change3, change2);
|
||||
assertQuery("intopic:fixup", change4);
|
||||
assertQuery("topic:\"\"", change5);
|
||||
assertQuery("intopic:\"\"", change5);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user