Fix intopic predicate with regex

There were many changes in the topic predicate since the last time it
worked with regex but the first change that introduced this regression
is Ifdb12319. It changed the topic field from exact match to prefix which
broke the regex search.

Bug: Issue 5759
Change-Id: Ifa35083c5802c3cb980a58c035ff4f8efd9fac7b
This commit is contained in:
Hugo Arès 2017-04-03 18:37:03 -04:00
parent 15e9a266b3
commit 37b9293dca
2 changed files with 3 additions and 1 deletions

View File

@ -26,7 +26,7 @@ class RegexTopicPredicate extends RegexPredicate<ChangeData> {
private final RunAutomaton pattern;
RegexTopicPredicate(Schema<ChangeData> schema, String re) {
super(FuzzyTopicPredicate.topicField(schema), re);
super(ExactTopicPredicate.topicField(schema), re);
if (re.startsWith("^")) {
re = re.substring(1);

View File

@ -542,6 +542,8 @@ public abstract class AbstractQueryChangesTest {
assertQuery("intopic:fixup", change4);
assertQuery("topic:\"\"", change5);
assertQuery("intopic:\"\"", change5);
assertQuery("intopic:^feature2.*", change4, change2);
assertQuery("intopic:{^.*feature2$}", change3, change2);
}
@Test