Merge "ChangeQueryBuilder: Make the any predicate use only for Elasticsearch" into stable-3.0
This commit is contained in:
@@ -784,20 +784,15 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData, ChangeQueryBuil
|
||||
return new RegexDirectoryPredicate(directory);
|
||||
}
|
||||
|
||||
DirectoryPredicate rootPredicate = new DirectoryPredicate(directory);
|
||||
if (isRootAndRecursive(directory)) {
|
||||
RegexDirectoryPredicate recursivePredicate = new RegexDirectoryPredicate("^.*");
|
||||
return Predicate.or(rootPredicate, recursivePredicate);
|
||||
if (IndexModule.getIndexType(cfg).equals(IndexType.ELASTICSEARCH)
|
||||
&& (directory.isEmpty() || directory.equals("/"))) {
|
||||
return Predicate.any();
|
||||
}
|
||||
return rootPredicate;
|
||||
return new DirectoryPredicate(directory);
|
||||
}
|
||||
throw new QueryParseException("'directory' operator is not supported by change index version");
|
||||
}
|
||||
|
||||
private static boolean isRootAndRecursive(String directory) {
|
||||
return directory.isEmpty() || directory.equals("/");
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> label(String name)
|
||||
throws QueryParseException, IOException, ConfigInvalidException {
|
||||
|
||||
Reference in New Issue
Block a user