bitflicker64 commented on code in PR #503:
URL: https://github.com/apache/hugegraph-doc/pull/503#discussion_r4164971919


##########
content/en/docs/clients/restful-api/vertex.md:
##########
@@ -367,14 +367,26 @@ PUT 
http://127.0.0.1:8080/graphspaces/DEFAULT/graphs/hugegraph/graph/vertices/"1
 #### Params
 
 - label: Vertex type
-- properties: Property key-value pairs (precondition: indexes are created for 
property queries)
+- properties: Property key-value pairs (see index coverage below)
 - keep_start_p: Default is false. When set to true, the range matching input 
expression will not be automatically escaped. For example, 
`properties={"age":"P.gt(18)"}` will be interpreted as an exact match, i.e., 
the age property is equal to the string "P.gt(18)"
 - offset: Offset, default is 0
 - limit: Maximum number of results, default is 100
 - page: Page number
 
 All of the above parameters are optional. `page` can not be combined with a 
non-zero `offset`, everything else can be combined in any way.
 
+If `label` selects a vertex label with the `PRIMARY_KEY` ID strategy and 
`properties` supplies exact values for all its primary-key fields, the query 
looks up
+the vertex by ID. Additional property conditions are checked on that vertex 
and do not need a property index.
+
+For other `properties` queries, the specified `label` needs a property index 
compatible with the query conditions. If `label` is omitted, candidate labels 
are

Review Comment:
   Minor: "For other `properties` queries, the specified `label` needs a 
property index" does not hold when every primary-key field has a condition but 
at least one is not an exact value.
   
   At apache/hugegraph#3243 head 7f5a917, `GraphTransaction.optimizeQuery()` 
takes the primary-key path whenever 
`query.matchUserpropKeys(vertexLabel.primaryKeys())` is true. 
`matchUserpropKeys()` only checks that the keys are present 
(`conditionKeys.containsAll(keys)`), not the relation. The path then calls 
`query.userpropValuesString(keys)`, which runs `E.checkState(r.relation == EQ 
|| r.relation == CONTAINS, "... relation must be EQ or CONTAINS, but got %s")`. 
So `GET .../vertices?label=person&properties={"name":"P.gt(\"a\")"}` on a label 
whose primary key is `name` fails with that error even when a range index on 
`name` exists. The query never reaches `GraphIndexTransaction`, so the index 
coverage rule in this paragraph does not apply to it.
   
   Requested change: add one sentence after the PRIMARY_KEY paragraph saying 
that when `label` is set and `properties` has a condition on every primary-key 
field, all of those conditions must be exact values; a range or other predicate 
on a primary-key field is rejected, and a property index does not help. Mirror 
it in content/cn/docs/clients/restful-api/vertex.md (line 424).



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