hahahahbenny opened a new pull request, #2856:
URL: https://github.com/apache/incubator-hugegraph/pull/2856
<!--
Thank you very much for contributing to Apache HugeGraph, we are happy
that you want to help us improve it!
Here are some tips for you:
1. If this is your first time, please read the [contributing
guidelines](https://github.com/apache/hugegraph/blob/master/CONTRIBUTING.md)
2. If a PR fix/close an issue, type the message "close xxx" (xxx is the
link of related
issue) in the content, GitHub will auto link it (Required)
3. Name the PR title in "Google Commit Format", start with "feat | fix |
perf | refactor | doc | chore",
such like: "feat(core): support the PageRank algorithm" or "fix: wrong
break in the compute loop" (module is optional)
skip it if you are unsure about which is the best component.
4. One PR address one issue, better not to mix up multiple issues.
5. Put an `x` in the `[ ]` to mark the item as CHECKED. `[x]` (or click
it directly after
published)
-->
## Purpose of the PR
- Add the vector index type and the detection of related fields
<!--
Please explain more context in this section, clarify why the changes are
needed.
e.g:
- If you propose a new API, clarify the use case for a new API.
- If you fix a bug, you can clarify why it is a bug, and should be
associated with an issue.
-->
## Main Changes
1. Add the vector index type to the index label.
2. Verify that the requested fields are of type float list.
3. Check whether dimension and metric in userdata are null.
4. Add vector-index–related logic to the CreateIndex RESTful API.
In following API
`POST http://localhost:8080/graphs/hugegraph/schema/indexlabels`
now support this request json body
```
{
"name": "personBy",
"base_type": "VERTEX_LABEL",
"base_value": "person",
"index_type": "VECTOR",
"fields": ["embedding"],
"user_data": {
"dimension" : 1526,
"metric" : "cosine"
}
}
```
## attention
1. The user_data object must explicitly declare both dimension and metric.
2. The API only accepts fields whose type is float list (array of floats).
## 主要变化
1. 将 vector 索引类型添加到 index label。
2. 校验请求中的字段类型必须为 float list。
3. 检查 user_data 中的 dimension 和 metric 是否为空。
3. 在 CreateIndex RESTful API 中增加 vector 索引相关逻辑。
目前在createInLabel 的接口中
`POST http://localhost:8080/graphs/hugegraph/schema/indexlabels`
现已支持如下请求 JSON 体:
```
{
"name": "personBy",
"base_type": "VERTEX_LABEL",
"base_value": "person",
"index_type": "VECTOR",
"fields": ["embedding"],
"user_data": {
"dimension" : 1526,
"metric" : "cosine"
}
}
```
<!-- Please clarify what changes you are proposing. The purpose of this
section is to outline the changes and how this PR fixes the issue. These change
logs are helpful for better and faster reviews.)
For example:
- If you introduce a new feature, please show detailed design here or add
the link of design documentation.
- If you refactor some codes with changing classes, showing the class
hierarchy will help reviewers.
- If there is a discussion in the mailing list, please add the link. -->
## Verifying these changes
<!-- Please pick the proper options below -->
- [ ] Trivial rework / code cleanup without any test coverage. (No Need)
- [ ] Already covered by existing tests, such as *(please modify tests
here)*.
- [ ] Need tests and can be verified as follows:
- xxx
## Does this PR potentially affect the following parts?
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] Dependencies ([add/update
license](https://hugegraph.apache.org/docs/contribution-guidelines/contribute/#321-check-licenses)
info &
[regenerate_known_dependencies.sh](../install-dist/scripts/dependency/regenerate_known_dependencies.sh))
<!-- Don't forget to add/update the info in "LICENSE" & "NOTICE" files (both
in root & dist module) -->
- [ ] Modify configurations
- [x] The public API
- [ ] Other affects (typed here)
- [ ] Nope
## Documentation Status
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `Doc - TODO` <!-- Your PR changes impact docs and you will update
later -->
- [ ] `Doc - Done` <!-- Related docs have been already added or updated -->
- [ ] `Doc - No Need` <!-- Your PR changes don't impact/need docs -->
--
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]