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

   <!-- Answer -->
   Yes, the code related to this bug is identifiable. The core logic for index 
enforcement and the NoIndexException is in ConditionQuery.java, which manages 
query conditions and checks if properties used in filters (like not-equal, 
range, or secondary conditions) are indexed. If not, it throws exceptions such 
as NoIndexException. The relevant methods include hasNeqCondition(), 
hasRangeCondition(), hasSecondaryCondition(), and test(), which applies all 
conditions and triggers the exception if requirements aren't met. See 
[ConditionQuery.java](https://github.com/apache/incubator-hugegraph/blob/a53af864b31f803780a1db31cb20d3d94d5d34fc/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/ConditionQuery.java#L497-L637).
   
   For traversal optimization, HugeVertexStepStrategy.java is responsible for 
extracting filter conditions from the main traversal and pushing them into 
backend queries. However, it does not extract or optimize filters inside nested 
traversals like match() or repeat(), which is why index enforcement behaves 
differently in those cases. See 
[HugeVertexStepStrategy.java](https://github.com/apache/incubator-hugegraph/blob/a53af864b31f803780a1db31cb20d3d94d5d34fc/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStepStrategy.java#L51-L91).
   
   If you want to address this bug, you would likely need to enhance how 
HugeVertexStepStrategy (and related traversal utilities) extract and enforce 
filter conditions from nested traversals, not just the top-level steps. This is 
a known area for improvement in HugeGraph's query planner design and has been 
discussed in related issues and threads 
([example](https://github.com/apache/incubator-hugegraph/issues/2929#issuecomment-3714894172)).
   
   
   <!-- 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/e3f8a40c-c8ba-43ca-bee1-e5dc0c619f55?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/e3f8a40c-c8ba-43ca-bee1-e5dc0c619f55?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/e3f8a40c-c8ba-43ca-bee1-e5dc0c619f55?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/e3f8a40c-c8ba-43ca-bee1-e5dc0c619f55?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/e3f8a40c-c8ba-43ca-bee1-e5dc0c619f55?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/e3f8a40c-c8ba-43ca-bee1-e5dc0c619f55?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/e3f8a40c-c8ba-43ca-bee1-e5dc0c619f55?feedback_type=other)</sup>
   
   [![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/e5e246fa-a522-4d8a-ab3c-e2588b5b501b/ask?utm_source=github)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Yes%2C%20the%20code%20related%20to%20this%20bug%20is%20identifiable.%20The%20core%20logic%20for%20index%20enforcement%20and%20the%20NoIndexException%20is%20in%20ConditionQuery.java%2C%20which%20manages%20query%20conditions%20and%20checks%20if%20properties%20used%20in%20filters%20%28like%20not-equal%2C%20range%2C%20or%20secondary%20conditions%29%20are%20indexed.%20If%20not%2C%20it%20throws%20exceptions%20such%20as%20NoIndexException.%20The%20relevant%20methods%20include%20hasNeqCondition%28%29%2C%20hasRangeCondition%28%29%2C%20hasSecondaryCondition%28%29%2C%20and%20test%28%29%2C%20which%20applies%20all%20conditions%20and%20triggers%20the%20exception%20if%20requirements%20aren%27t%20met.%20See%20%5BConditionQuery.java%5D%28https%3A//github.com/apache
 
/incubator-hugegraph/blob/a53af864b31f803780a1db31cb20d3d94d5d34fc/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/ConditionQuery.java%23L497-L637%29.%0A%0AFor%20traversal%20optimization%2C%20HugeVertexStepStrategy.java%20is%20responsible%20for%20extracting%20filter%20conditions%20from%20the%20main%20traversal%20and%20pushing%20them%20into%20backend%20queries.%20However%2C%20it%20does%20not%20extract%20or%20optimize%20filters%20inside%20nested%20traversals%20like%20match%28%29%20or%20repeat%28%29%2C%20which%20is%20why%20index%20enforcement%20behaves%20differently%20in%20those%20cases.%20See%20%5BHugeVertexStepStrategy.java%5D%28https%3A//github.com/apache/incubator-hugegraph/blob/a53af864b31f803780a1db31cb20d3d94d5d34fc/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/HugeVertexStepStrategy.java%23L51-L91%29.%0A%0AIf%20you%20want%20to%20address%20this%20bug%2C%20you%20would%20likely%20need%20to%20enhance%20how%20H
 
ugeVertexStepStrategy%20%28and%20related%20traversal%20utilities%29%20extract%20and%20enforce%20filter%20conditions%20from%20nested%20traversals%2C%20not%20just%20the%20top-level%20steps.%20This%20is%20a%20known%20area%20for%20improvement%20in%20HugeGraph%27s%20query%20planner%20design%20and%20has%20been%20discussed%20in%20related%20issues%20and%20threads%20%28%5Bexample%5D%28https%3A//github.com/apache/incubator-hugegraph/issues/2929%23issuecomment-3714894172%29%29.)&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/issues/2936)


-- 
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