Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support vector index #612

Merged
merged 82 commits into from
Sep 18, 2024
Merged

Conversation

Jant1L
Copy link
Contributor

@Jant1L Jant1L commented Jul 26, 2024

Support create vector index and query similarity

How to create a vertex which contains vector property:
eg:
CALL db.createVertexLabel('person', 'id', 'id', 'int64', false, 'vector', 'float_vector', true);
CREATE (n:person {id:2001, vector: [1.0,2.0,3.0]});

Create vector index:
vector.AddVectorIndex(label_name, field_name, index_type, vec_dimension, distance_type ,index_spec);

eg:for HNSW, it need 2 parameters for index_spec:Max_degree && ef_construction
CALL vector.AddVectorIndex('person', 'vector', 'HNSW', 4, 'L2' ,24 , 100);

Delete vector index:
vector.DeleteVectorIndex(label_name, field_name, index_type, vec_dimension, distance_type);

eg:
CALL vector.DeleteVectorIndex('person', 'vector', ' HNSW ', 4, 'L2');

Show vector index:
CALL vector.ShowVectorIndex();

Query by using vector index:
CALL vector.VectorIndexQuery(label_name, field_name, vector, vec_dimension, query_spec);

eg:for HNSW, it need 1 parameter for index_spec:ef_search
CALL vector.VectorIndexQuery('person', 'vector', [1,2,3,4], 4, 10);

What support now:
VSAG HNSW

TODO:
support more vector index algorithm and library

@CLAassistant
Copy link

CLAassistant commented Aug 2, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
3 out of 4 committers have signed the CLA.

✅ Jant1L
✅ PPPoint-t
✅ lipanpan03
❌ tugraph


tugraph seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ Jant1L
❌ PPPoint-t
You have signed the CLA already but the status is still pending? Let us recheck it.

"CREATE (n:person {id:4, vector: [4.0,4.0,4.0,4.0]})");
UT_EXPECT_TRUE(ret);
ret = client.CallCypher(str,
"CALL vector.VectorIndexQuery('person','vector',[1,2,3,4], 2, 10)");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CALL vector.VectorIndexQuery('person','vector',[1,2,3,4], 2, 10)") 这个返回结果是什么,向量检索的最终目的是用来查点的。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

返回结果是 对应的vid label_name field_name vector distance

@@ -123,6 +128,9 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
target_link_libraries(${TARGET_LGRAPH} PUBLIC
vsag
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vsag改成静态库编译

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vsag改成静态库编译

确认了,静态库搞不定,只能链接动态库

@ljcui
Copy link
Collaborator

ljcui commented Sep 18, 2024

这一版,先暂时合并进去。

@ljcui ljcui merged commit 6b76fe6 into TuGraph-family:master Sep 18, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants