Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,10 @@ public static Relation textContainsAny(Id key, Set<String> words) {
return new UserpropRelation(key, RelationType.TEXT_CONTAINS_ANY, words);
}

public static Condition contains(Id key, Object value) {
return new UserpropRelation(key, RelationType.CONTAINS, value);
}

/**
* Condition defines
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
import com.baidu.hugegraph.type.define.Action;
import com.baidu.hugegraph.type.define.HugeKeys;
import com.baidu.hugegraph.type.define.IndexType;
import com.baidu.hugegraph.type.define.SchemaStatus;
import com.baidu.hugegraph.util.CollectionUtil;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.InsertionOrderUtil;
Expand Down Expand Up @@ -1347,6 +1346,9 @@ private static NoIndexException noIndexException(HugeGraph graph,
if (query.hasNeqCondition()) {
mismatched.add("not-equal");
}
if (mismatched.isEmpty()) {
mismatched.add(query.relations().toString());
}
return new NoIndexException("Don't accept query based on properties " +
"%s that are not indexed in %s, " +
"may not match %s condition",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private ConditionP(final BiPredicate<Object, Object> predicate,
super(predicate, value);
}

public static ConditionP textContains(String value) {
public static ConditionP textContains(Object value) {
return new ConditionP(RelationType.TEXT_CONTAINS, value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,8 @@ public static P<Object> parsePredicate(String predicate) {
return P.outside(params[0], params[1]);
case "within":
return P.within(predicateArgs(value));
case "textcontains":
return ConditionP.textContains(predicateArg(value));
case "contains":
// Just for inner use case like auth filter
return ConditionP.contains(predicateArg(value));
Expand Down Expand Up @@ -868,6 +870,12 @@ public static Condition parsePredicate(PropertyKey pk, String predicate) {
validValues.add(validPropertyValue(v, pk));
}
return Condition.in(pk.id(), validValues);
case "textcontains":
validValue = validPropertyValue(value, pk);
return Condition.textContains(pk.id(), (String) validValue);
case "contains":
validValue = validPropertyValue(value, pk);
return Condition.contains(pk.id(), validValue);
default:
throw new NotSupportException("predicate '%s'", method);
}
Expand Down