Skip to content

Commit a621462

Browse files
committed
Fix typo
1 parent 7e6f165 commit a621462

File tree

12 files changed

+38
-38
lines changed

12 files changed

+38
-38
lines changed

demo/Bolt/go_example.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func main() {
2323
panic(err)
2424
return
2525
}
26-
_, err = session.Run(ctx, "CALL db.createVertexLabel('person', 'id' , 'id' ,INT32, false, 'name' ,STRING, false)", nil)
26+
_, err = session.Run(ctx, "CALL db.createVertexLabel('person', 'id' , 'id' ,'INT32', false, 'name' ,'STRING', false)", nil)
2727
if err != nil {
2828
panic(err)
2929
return

demo/Bolt/java_example.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public static void main( final String[] args ) {
1010
Driver driver = GraphDatabase.driver("bolt://localhost:7687", AuthTokens.basic("admin", "73@TuGraph"));
1111
Session session = driver.session(SessionConfig.forDatabase("default"));
1212
session.run("CALL db.dropDB()");
13-
session.run("CALL db.createVertexLabel('person', 'id' , 'id' ,INT32, false, 'name' ,STRING, false)");
13+
session.run("CALL db.createVertexLabel('person', 'id' , 'id' ,'INT32', false, 'name', 'STRING', false)");
1414
session.run("CALL db.createEdgeLabel('is_friend','[[\"person\",\"person\"]]')");
1515
session.run("create (n1:person {name:'jack',id:1}), (n2:person {name:'lucy',id:2})");
1616
session.run("match (n1:person {id:1}), (n2:person {id:2}) create (n1)-[r:is_friend]->(n2)");

demo/Bolt/js_example.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
var session = driver.session({database: 'default'})
55
await session.run("CALL db.dropDB()");
66
console.log("clean db");
7-
await session.run("CALL db.createVertexLabel('person', 'id' , 'id' ,INT32, false, 'name' ,STRING, false)");
7+
await session.run("CALL db.createVertexLabel('person', 'id' , 'id', 'INT32', false, 'name', 'STRING', false)");
88
console.log("add vertex label");
99
await session.run("CALL db.createEdgeLabel('is_friend','[[\"person\",\"person\"]]')");
1010
console.log("add edge label");

demo/Bolt/python_example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
with GraphDatabase.driver(URI, auth=AUTH) as client:
66
session = client.session(database="default")
77
session.run("CALL db.dropDB()")
8-
session.run("CALL db.createVertexLabel('person', 'id' , 'id' ,INT32, false, 'name' ,STRING, false)")
8+
session.run("CALL db.createVertexLabel('person', 'id' , 'id', 'INT32', false, 'name', 'STRING', false)")
99
session.run("CALL db.createEdgeLabel('is_friend','[[\"person\",\"person\"]]')")
1010
session.run("create (n1:person {name:'jack',id:1}), (n2:person {name:'lucy',id:2})")
1111
session.run("match (n1:person {id:1}), (n2:person {id:2}) create (n1)-[r:is_friend]->(n2)")

demo/Bolt/rust_example.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ async fn main() {
1414
let graph = Graph::connect(config).await.unwrap();
1515
{
1616
graph.run(query("CALL db.dropDB()")).await.unwrap();
17-
graph.run(query("CALL db.createVertexLabel('person', 'id' , 'id' ,INT32, false, 'name' ,STRING, false)")).await.unwrap();
17+
graph.run(query("CALL db.createVertexLabel('person', 'id' , 'id', 'INT32', false, 'name', 'STRING', false)")).await.unwrap();
1818
graph.run(query("CALL db.createEdgeLabel('is_friend','[[\"person\",\"person\"]]')")).await.unwrap();
1919
graph.run(query("create (n1:person {name:'jack',id:1}), (n2:person {name:'lucy',id:2})")).await.unwrap();
2020
graph.run(query("match (n1:person {id:1}), (n2:person {id:2}) create (n1)-[r:is_friend]->(n2)")).await.unwrap();

include/lgraph/lgraph_types.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1296,8 +1296,8 @@ struct VectorIndexSpec {
12961296
std::string index_type;
12971297
int dimension;
12981298
std::string distance_type;
1299-
int hnsm_m;
1300-
int hnsm_ef_construction;
1299+
int hnsw_m;
1300+
int hnsw_ef_construction;
13011301
};
13021302

13031303
struct EdgeUid {

src/core/index_manager.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ IndexManager::IndexManager(KvTransaction& txn, SchemaManager* v_schema_manager,
107107
std::unique_ptr<VectorIndex> vsag_index;
108108
vsag_index.reset(dynamic_cast<lgraph::VectorIndex*> (
109109
new HNSW(idx.label, idx.field, idx.distance_type, idx.index_type,
110-
idx.dimension, {idx.hnsm_m, idx.hnsm_ef_construction})));
110+
idx.dimension, {idx.hnsw_m, idx.hnsw_ef_construction})));
111111
uint64_t count = 0;
112112
std::vector<std::vector<float>> floatvector;
113113
std::vector<int64_t> vids;
@@ -185,8 +185,8 @@ bool IndexManager::AddVectorIndex(KvTransaction& txn, const std::string& label,
185185
idx.index_type = index_type;
186186
idx.dimension = vec_dimension;
187187
idx.distance_type = distance_type;
188-
idx.hnsm_m = index_spec[0];
189-
idx.hnsm_ef_construction = index_spec[1];
188+
idx.hnsw_m = index_spec[0];
189+
idx.hnsw_ef_construction = index_spec[1];
190190
auto table_name = GetVertexVectorIndexTableName(label, field);
191191
auto it = index_list_table_->GetIterator(txn, Value::ConstRef(table_name));
192192
if (it->IsValid()) return false; // already exist
@@ -315,8 +315,8 @@ std::vector<VectorIndexSpec> IndexManager::ListVectorIndex(KvTransaction& txn) {
315315
vs.index_type = vi.index_type;
316316
vs.dimension = vi.dimension;
317317
vs.distance_type = vi.distance_type;
318-
vs.hnsm_m = vi.hnsm_m;
319-
vs.hnsm_ef_construction = vi.hnsm_ef_construction;
318+
vs.hnsw_m = vi.hnsw_m;
319+
vs.hnsw_ef_construction = vi.hnsw_ef_construction;
320320
ret.emplace_back(vs);
321321
}
322322
}

src/core/index_manager.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -111,20 +111,20 @@ struct VectorIndexEntry {
111111
std::string index_type;
112112
int dimension;
113113
std::string distance_type;
114-
int hnsm_m;
115-
int hnsm_ef_construction;
114+
int hnsw_m;
115+
int hnsw_ef_construction;
116116
template <typename StreamT>
117117
size_t Serialize(StreamT& buf) const {
118118
return BinaryWrite(buf, label) + BinaryWrite(buf, field) + BinaryWrite(buf, index_type) +
119119
BinaryWrite(buf, dimension) + BinaryWrite(buf, distance_type) +
120-
BinaryWrite(buf, hnsm_m) + BinaryWrite(buf, hnsm_ef_construction);
120+
BinaryWrite(buf, hnsw_m) + BinaryWrite(buf, hnsw_ef_construction);
121121
}
122122

123123
template <typename StreamT>
124124
size_t Deserialize(StreamT& buf) {
125125
return BinaryRead(buf, label) + BinaryRead(buf, field) + BinaryRead(buf, index_type) +
126126
BinaryRead(buf, dimension) + BinaryRead(buf, distance_type) +
127-
BinaryRead(buf, hnsm_m) + BinaryRead(buf, hnsm_ef_construction);
127+
BinaryRead(buf, hnsw_m) + BinaryRead(buf, hnsw_ef_construction);
128128
}
129129
};
130130

src/cypher/procedure/procedure.cpp

+15-15
Original file line numberDiff line numberDiff line change
@@ -4189,19 +4189,19 @@ void VectorFunc::AddVertexVectorIndex(RTContext *ctx, const cypher::Record *reco
41894189
}
41904190
CYPHER_ARG_CHECK((distance_type == "l2" || distance_type == "ip"),
41914191
"Distance type should be one of them : l2, ip");
4192-
int hnsm_m = 16;
4193-
if (parameter.count("hnsm_m")) {
4194-
hnsm_m = (int)parameter.at("hnsm_m").AsInt64();
4195-
}
4196-
CYPHER_ARG_CHECK((hnsm_m <= 64 && hnsm_m >= 5),
4197-
"hnsm.m should be an integer in the range [5, 64]");
4198-
int hnsm_ef_construction = 100;
4199-
if (parameter.count("hnsm_ef_construction")) {
4200-
hnsm_ef_construction = (int)parameter.at("hnsm_ef_construction").AsInt64();
4201-
}
4202-
CYPHER_ARG_CHECK((hnsm_ef_construction <= 1000 && hnsm_ef_construction >= hnsm_m),
4203-
"hnsm.efConstruction should be an integer in the range [hnsm.m,1000]");
4204-
std::vector<int> index_spec = {hnsm_m, hnsm_ef_construction};
4192+
int hnsw_m = 16;
4193+
if (parameter.count("hnsw_m")) {
4194+
hnsw_m = (int)parameter.at("hnsw_m").AsInt64();
4195+
}
4196+
CYPHER_ARG_CHECK((hnsw_m <= 64 && hnsw_m >= 5),
4197+
"hnsw.m should be an integer in the range [5, 64]");
4198+
int hnsw_ef_construction = 100;
4199+
if (parameter.count("hnsw_ef_construction")) {
4200+
hnsw_ef_construction = (int)parameter.at("hnsw_ef_construction").AsInt64();
4201+
}
4202+
CYPHER_ARG_CHECK((hnsw_ef_construction <= 1000 && hnsw_ef_construction >= hnsw_m),
4203+
"hnsw.efConstruction should be an integer in the range [hnsw.m,1000]");
4204+
std::vector<int> index_spec = {hnsw_m, hnsw_ef_construction};
42054205
auto ac_db = ctx->galaxy_->OpenGraph(ctx->user_, ctx->graph_);
42064206
bool success = ac_db.AddVectorIndex(true, label, field, index_type,
42074207
dimension, distance_type, index_spec);
@@ -4252,8 +4252,8 @@ void VectorFunc::ShowVertexVectorIndex(RTContext *ctx, const cypher::Record *rec
42524252
r.AddConstant(lgraph::FieldData(item.index_type));
42534253
r.AddConstant(lgraph::FieldData(item.dimension));
42544254
r.AddConstant(lgraph::FieldData(item.distance_type));
4255-
r.AddConstant(lgraph::FieldData(item.hnsm_m));
4256-
r.AddConstant(lgraph::FieldData(item.hnsm_ef_construction));
4255+
r.AddConstant(lgraph::FieldData(item.hnsw_m));
4256+
r.AddConstant(lgraph::FieldData(item.hnsw_ef_construction));
42574257
records->emplace_back(r.Snapshot());
42584258
}
42594259
FillProcedureYieldItem("db.showVertexVectorIndex", yield_items, records);

src/cypher/procedure/procedure.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -948,8 +948,8 @@ static std::vector<Procedure> global_procedures = {
948948
{"index_type", {2, lgraph_api::LGraphType::STRING}},
949949
{"dimension", {3, lgraph_api::LGraphType::INTEGER}},
950950
{"distance_type", {4, lgraph_api::LGraphType::STRING}},
951-
{"hnsm.m", {5, lgraph_api::LGraphType::INTEGER}},
952-
{"hnsm.ef_construction", {6, lgraph_api::LGraphType::INTEGER}},
951+
{"hnsw.m", {5, lgraph_api::LGraphType::INTEGER}},
952+
{"hnsw.ef_construction", {6, lgraph_api::LGraphType::INTEGER}},
953953
}),
954954

955955
Procedure("db.vertexVectorKnnSearch", VectorFunc::VertexVectorKnnSearch,

test/resource/unit_test/procedure/cypher/procedure.result

+3-3
Large diffs are not rendered by default.

test/resource/unit_test/vector_index/cypher/vector_index.result

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ CALL db.addVertexVectorIndex('person','embedding2', {dimension:4});
77
CALL db.addVertexVectorIndex('person','name', {dimension:4});
88
[VectorIndexException] Only FLOAT_VECTOR type supports vector index
99
CALL db.showVertexVectorIndex();
10-
[{"dimension":4,"distance_type":"l2","field_name":"embedding1","hnsm.ef_construction":100,"hnsm.m":16,"index_type":"hnsw","label_name":"person"},{"dimension":4,"distance_type":"l2","field_name":"embedding2","hnsm.ef_construction":100,"hnsm.m":16,"index_type":"hnsw","label_name":"person"}]
10+
[{"dimension":4,"distance_type":"l2","field_name":"embedding1","hnsw.ef_construction":100,"hnsw.m":16,"index_type":"hnsw","label_name":"person"},{"dimension":4,"distance_type":"l2","field_name":"embedding2","hnsw.ef_construction":100,"hnsw.m":16,"index_type":"hnsw","label_name":"person"}]
1111
CREATE (n:person {id:1, name:'name1', embedding1: [1.0,1.0,1.0,1.0], embedding2: [11.0,11.0,11.0,11.0]});
1212
[{"<SUMMARY>":"created 1 vertices, created 0 edges."}]
1313
CREATE (n:person {id:2, name:'name2', embedding1: [2.0,2.0,2.0,2.0], embedding2: [12.0,12.0,12.0,12.0]});
@@ -35,7 +35,7 @@ CALL db.vertexVectorRangeSearch('person','embedding1', [1.0,2.0,3.0,4.0], {radiu
3535
CALL db.alterLabelDelFields('vertex', 'person', ['embedding1']);
3636
[{"record_affected":3}]
3737
CALL db.showVertexVectorIndex();
38-
[{"dimension":4,"distance_type":"l2","field_name":"embedding2","hnsm.ef_construction":100,"hnsm.m":16,"index_type":"hnsw","label_name":"person"}]
38+
[{"dimension":4,"distance_type":"l2","field_name":"embedding2","hnsw.ef_construction":100,"hnsw.m":16,"index_type":"hnsw","label_name":"person"}]
3939
CALL db.vertexVectorKnnSearch('person','embedding1',[1,2,3,4], {top_k:2, hnsw_ef_search:10}) yield node return node.id;
4040
[FieldNotFound] Field [embedding1] does not exist.
4141
CALL db.vertexVectorKnnSearch('person','embedding2',[1,2,3,4], {top_k:2, hnsw_ef_search:10}) yield node return node.id;

0 commit comments

Comments
 (0)