VGalaxies commented on code in PR #2994:
URL: https://github.com/apache/hugegraph/pull/2994#discussion_r3566593937
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphIndexTransaction.java:
##########
@@ -945,7 +956,7 @@ private void removeExpiredIndexIfNeeded(HugeIndex index,
private static Set<IndexLabel> matchSingleOrCompositeIndex(
ConditionQuery query,
Set<IndexLabel> indexLabels) {
- if (query.hasNeqCondition()) {
+ if (query.hasUserpropNeqCondition()) {
Review Comment:
### 🚨 P1 · Require complete per-label index coverage for negative-label
queries
#### 🔄 Contract mismatch
| Expected behavior | Actual behavior |
| --- | --- |
| The query returns every matching vertex from all non-excluded labels, or
explicitly rejects/falls back when the available indexes cannot cover every
eligible label. | Only the `person` `city` index is queried; matching `fan` and
`follower` labels without an equivalent `city` index are silently skipped,
producing false-negative results. |
`hasUserpropNeqCondition()` permits label `NEQ` with indexed properties. The
schema gives `city` to `person`, `fan`, and `follower`, but
`initPersonIndex(true)` indexes it only for `person`; `collectMatchedIndexes()`
then silently skips the other eligible labels when no matching `city` index
exists. A query such as `g.V().has(T.label, P.neq("author")).has("city",
"Beijing")` can therefore omit matching `fan` and `follower` vertices.
> [!IMPORTANT]
> **Impact:** A matching `fan` or `follower` vertex is never read, so the
query silently returns incomplete data instead of all vertices satisfying the
negative-label and `city` predicates.
#### 🛠️ Suggested change
Require matching index coverage for every non-excluded label capable of
satisfying the queried properties. If coverage is incomplete, reject with
`NoIndexException` or use a complete-scan path. Add a regression test
containing a matching `fan` or `follower` vertex.
---
<sub>🤖 Codex review · **GPT-5.6 Sol** · effort: **xhigh**</sub>
--
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]