dosubot[bot] commented on issue #2788: URL: https://github.com/apache/incubator-hugegraph/issues/2788#issuecomment-2953794389
<!-- Answer --> CONTAINS 不是 Gremlin 查询里的有效操作符,出现 “No such property: CONTAINS” 报错是因为 HugeGraph 的 Gremlin 语法并不支持直接写 CONTAINS。HugeGraph 查询 set/list 属性时,应该用 ConditionP.contains(),而不是 CONTAINS 关键字。 正确写法如下(以 tags 属性为例): ```groovy .option("domain", has("tags", ConditionP.contains("涉案"))) ``` 你需要在 Gremlin 控制台或 API 里先引入 ConditionP: ```groovy import org.apache.hugegraph.traversal.optimize.ConditionP ``` 完整嵌入 choose 的写法: ```groovy .where( __.choose(label()) .option("domain", has("tags", ConditionP.contains("涉案"))) .option("contact_person", has("text", P.within("吴九","周八"))) .option("ip", has("text", P.within("192.168.12.52","192.168.12.55"))) .option(none, constant(true)) ) ``` 注意:ConditionP.contains 只能在 HugeGraph 环境下用,且 tags 字段必须有二级索引(你的 schema 已经有 domain_by_tags,没问题)。详细说明和案例见 [issues/2753](https://github.com/apache/incubator-hugegraph/issues/2753)。 如果你用的是 Gremlin 控制台,记得先 import,或者直接在 Java/REST API 里拼装 ConditionP.contains 查询。 <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/7d802cf6-75f4-4fb2-aae4-1ee5a7a583de?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/7d802cf6-75f4-4fb2-aae4-1ee5a7a583de?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/7d802cf6-75f4-4fb2-aae4-1ee5a7a583de?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/7d802cf6-75f4-4fb2-aae4-1ee5a7a583de?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/7d802cf6-75f4-4fb2-aae4-1ee5a7a583de?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/7d802cf6-75f4-4fb2-aae4-1ee5a7a583de?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/7d802cf6-75f4-4fb2-aae4-1ee5a7a583de?feedback_type=other)</sup> [](https://go.dosu.dev/discord-bot) [! [Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/incubator-hugegraph/issues/2788) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@hugegraph.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@hugegraph.apache.org For additional commands, e-mail: issues-h...@hugegraph.apache.org