dosubot[bot] commented on issue #670:
URL: 
https://github.com/apache/incubator-hugegraph-toolchain/issues/670#issuecomment-2938299029

   <!-- Answer -->
   K-neighbor API(包括 AVA 
客户端和服务端)目前不支持对顶点属性进行“谓词模糊匹配”(如模糊、正则、LIKE、contains、TEXT_CONTAINS 等)。K-neighbor 
API 的属性过滤仅支持精确值或标准 Gremlin 谓词(如 P.eq、P.gt、P.lte),不支持模糊、正则或 contains 
风格的匹配,也没有相关配置或插件方式可以实现这一点。相关源码和接口文档均未发现支持模糊谓词的实现或扩展方式[[源码参考](https://github.com/apache/incubator-hugegraph-toolchain/blob/50a839469b1ad779115e371d0df378116638e9e1/hugegraph-client/src/main/java/org/apache/hugegraph/structure/traverser/KneighborRequest.java)][[API参考](https://github.com/apache/incubator-hugegraph-toolchain/blob/50a839469b1ad779115e371d0df378116638e9e1/hugegraph-client/src/main/java/org/apache/hugegraph/api/traverser/KneighborAPI.java)]。
   
   如果需要模糊匹配(如属性包含某关键词、分词、逗号分割项等),推荐用 Gremlin 查询配合 Search 索引(如 
CONTAINS、TEXT_CONTAINS)先筛选出目标顶点,再用这些顶点作为 source 执行 K-neighbor 遍历。例如:
   
   ```java
   // 先用 Gremlin 查询模糊匹配
   g.V().hasLabel("org").has("alias", CONTAINS, "广州软件").limit(10)
   // 或
   g.V().hasLabel("org").has("alias", TEXT_CONTAINS, "广州软件").limit(10)
   ```
   需要为该属性建立 Search 索引,且属性类型为 SET/LIST 
时效果最佳[[用法说明](https://github.com/apache/incubator-hugegraph/issues/2753)]。
   
   总结:K-neighbor API 只支持精确或范围谓词过滤,不支持模糊谓词。模糊需求建议用 Gremlin + Search 索引先查出顶点,再用 
K-neighbor API 做遍历。
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention my name [@dosu](https://go.dosu.dev/dosubot).*
   
   ---
   <sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/11274a1c-e8f3-4a0a-89d7-97ca83c3b052?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/11274a1c-e8f3-4a0a-89d7-97ca83c3b052?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/11274a1c-e8f3-4a0a-89d7-97ca83c3b052?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/11274a1c-e8f3-4a0a-89d7-97ca83c3b052?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/11274a1c-e8f3-4a0a-89d7-97ca83c3b052?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/11274a1c-e8f3-4a0a-89d7-97ca83c3b052?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/11274a1c-e8f3-4a0a-89d7-97ca83c3b052?feedback_type=other)</sup>&nbsp;&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[!
 [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-toolchain/issues/670)


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to