Skip to content

Commit 1d340f0

Browse files
author
averiewang
committed
Merge branch 'feat/m12' into 'main' (merge request !73)
feat: failIndexedDocumentSets and collection/collectionView count * feat: support the user interface to grant or revoke privileges * feat: support to sort the data by the sortRules firstly, when quering documents * feat: return [FailIndexedDocumentSets] in describing collectionView's response * feat: return the number of collections/collectionViews in listing database's response
2 parents e79727e + 7487016 commit 1d340f0

File tree

13 files changed

+890
-859
lines changed

13 files changed

+890
-859
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
# Changelog
22

3+
## v1.6.0
4+
* feat: support the user interface to grant or revoke privileges
5+
* feat: support to sort the data by the sortRules firstly, when quering documents
6+
* feat: return [FailIndexedDocumentSets] in describing collectionView's response
7+
* feat: return the number of collections/collectionViews in listing database's response
8+
39
## v1.5.5
410
* refactor: update default stopwords file
11+
512
## v1.5.4
613
* feat: support search radius for searching in collection
714

example/demo/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ func (d *Demo) QueryData(ctx context.Context, database, collection string) error
233233
Filter: filter,
234234
RetrieveVector: true,
235235
OutputFields: outputField,
236-
Limit: 2,
237-
Offset: 1,
236+
Limit: 5,
237+
Offset: 0,
238238
Sort: []document.SortRule{
239239
{
240240
FieldName: "page",

tcvectordb/ai_collection_view.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ type AICollectionViewInterface interface {
6565
// for splitting document chunks. See [SplitterPreprocess] for more information.
6666
// - ParsingProcess: A pointer to a [ParsingProcess] object, which includes the parameters
6767
// for parsing files. See [ParsingProcess] for more information.
68-
// - IndexedDocumentSets: The number of documentSets that have been processed.
68+
// - FailIndexedDocumentSets: The number of documentSets that failed to be processed.
69+
// - IndexedDocumentSets: The number of documentSets that have been processed successfully.
6970
// - TotalDocumentSets: The total number of documentSets in this collectionView.
7071
// - UnIndexedDocumentSets: The number of documentSets that haven't been processed.
7172
// - FilterIndexes: A [Indexes] object that includes a list of the scalar filter index properties for the documentSets in a collectionView.
@@ -79,6 +80,7 @@ type AICollectionView struct {
7980
Embedding *collection_view.DocumentEmbedding `json:"embedding"`
8081
SplitterPreprocess *collection_view.SplitterPreprocess `json:"splitterPreprocess"`
8182
ParsingProcess *api.ParsingProcess `json:"parsingProcess"`
83+
FailIndexedDocumentSets uint64 `json:"failIndexedDocumentSets"`
8284
IndexedDocumentSets uint64 `json:"indexedDocumentSets"`
8385
TotalDocumentSets uint64 `json:"totalDocumentSets"`
8486
UnIndexedDocumentSets uint64 `json:"unIndexedDocumentSets"`
@@ -368,6 +370,7 @@ func (i *implementerCollectionView) toCollectionView(item *collection_view.Descr
368370
}
369371

370372
if item.Status != nil {
373+
coll.FailIndexedDocumentSets = item.Status.FailIndexedDocumentSets
371374
coll.IndexedDocumentSets = item.Status.IndexedDocumentSets
372375
coll.TotalDocumentSets = item.Status.TotalDocumentSets
373376
coll.UnIndexedDocumentSets = item.Status.UnIndexedDocumentSets

tcvectordb/api/collection_view/api.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ type DescribeCollectionViewItem struct {
8787
}
8888

8989
type Status struct {
90-
IndexedDocumentSets uint64 `json:"indexedDocumentSets"`
91-
TotalDocumentSets uint64 `json:"totalDocumentSets"`
92-
UnIndexedDocumentSets uint64 `json:"unIndexedDocumentSets"`
90+
FailIndexedDocumentSets uint64 `json:"failIndexedDocumentSets"`
91+
IndexedDocumentSets uint64 `json:"indexedDocumentSets"`
92+
TotalDocumentSets uint64 `json:"totalDocumentSets"`
93+
UnIndexedDocumentSets uint64 `json:"unIndexedDocumentSets"`
9394
}
9495

9596
// DropReq delete collectionView request

tcvectordb/api/database/api.go

+1
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,5 @@ type ListRes struct {
6868
type DatabaseInfo struct {
6969
CreateTime string `json:"createTime,omitempty"`
7070
DbType string `json:"dbType,omitempty"`
71+
Count int64 `json:"count"`
7172
}

tcvectordb/base_database.go

+3
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,13 @@ func (i *implementerDatabase) ListDatabase(ctx context.Context) (result *ListDat
263263
if res.Info[v].DbType == AIDOCDbType || res.Info[v].DbType == DbTypeAI {
264264
db := i.AIDatabase(v)
265265
db.Info.CreateTime = res.Info[v].CreateTime
266+
db.Info.Count = res.Info[v].Count
266267
result.AIDatabases = append(result.AIDatabases, *db)
267268
} else {
268269
db := i.Database(v)
269270
db.Info.CreateTime = res.Info[v].CreateTime
270271
db.Info.DbType = res.Info[v].DbType
272+
db.Info.Count = res.Info[v].Count
271273
result.Databases = append(result.Databases, *db)
272274
}
273275
}
@@ -353,6 +355,7 @@ func (d Database) IsAIDatabase() bool {
353355
type DatabaseItem struct {
354356
CreateTime string `json:"createTime,omitempty"`
355357
DbType string `json:"dbType,omitempty"`
358+
Count int64 `json:"count"`
356359
}
357360

358361
// Debug sets the debug mode for the SdkClient, which prints the request and response of a network call.

tcvectordb/olama/olama.pb.go

+848-838
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tcvectordb/olama/olama.proto

+2-1
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ enum DataType {
7979
}
8080

8181
message DatabaseItem {
82-
int64 create_time = 1;
82+
int64 create_time = 1;
8383
DataType db_type = 2;
84+
int64 count = 3;
8485
}
8586

8687
enum IndexMetricType {

tcvectordb/olama/olama_grpc.pb.go

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tcvectordb/rpc_base_database.go

+2
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,13 @@ func (r *rpcImplementerDatabase) ListDatabase(ctx context.Context) (result *List
133133
if res.Info[v].DbType == olama.DataType_AI_DOC {
134134
db := r.AIDatabase(v)
135135
db.Info.CreateTime = strconv.FormatInt(res.Info[v].CreateTime, 10)
136+
db.Info.Count = int64(res.Info[v].Count)
136137
result.AIDatabases = append(result.AIDatabases, *db)
137138
} else {
138139
db := r.Database(v)
139140
db.Info.CreateTime = strconv.FormatInt(res.Info[v].CreateTime, 10)
140141
db.Info.DbType = ConvertDbType(res.Info[v].DbType)
142+
db.Info.Count = int64(res.Info[v].Count)
141143
result.Databases = append(result.Databases, *db)
142144
}
143145
}

tcvectordb/version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818

1919
package tcvectordb
2020

21-
const SDKVersion = "v1.5.5"
21+
const SDKVersion = "v1.6.0"

test/normal_test.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,14 @@ func TestListDatabase(t *testing.T) {
5858
printErr(err)
5959
log.Printf("base database ======================")
6060
for _, db := range dbList.Databases {
61-
log.Printf("database: %s, createTime: %s, dbType: %s", db.DatabaseName, db.Info.CreateTime, db.Info.DbType)
61+
log.Printf("database: %s, createTime: %s, dbType: %s, collectionNum: %v", db.DatabaseName,
62+
db.Info.CreateTime, db.Info.DbType, db.Info.Count)
6263
}
6364

6465
log.Printf("AI database ======================")
6566
for _, db := range dbList.AIDatabases {
66-
log.Printf("database: %s, createTime: %s, dbType: %s", db.DatabaseName, db.Info.CreateTime, db.Info.DbType)
67+
log.Printf("database: %s, createTime: %s, dbType: %s, collectionViewNum: %v", db.DatabaseName,
68+
db.Info.CreateTime, db.Info.DbType, db.Info.Count)
6769
}
6870
}
6971

test/user_test.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,18 @@ func Test_User(t *testing.T) {
110110
printErr(err)
111111
println(ToJson(res))
112112

113-
cli, err := tcvectordb.NewRpcClient("http://gz-vdb-jco3bdic.sql.tencentcdb.com:8100", "test_user_1",
113+
newCli, err := tcvectordb.NewRpcClient("http://xx",
114+
"test_user_1",
114115
"123..A.!", &tcvectordb.ClientOption{Timeout: 10 * time.Second,
115116
ReadConsistency: tcvectordb.StrongConsistency})
116117
printErr(err)
117-
cli.Debug(true)
118+
newCli.Debug(true)
118119

119-
collRes, err := cli.Database(database).ListCollection(ctx)
120+
collRes, err := newCli.Database(database).ListCollection(ctx)
120121
printErr(err)
121122
println(ToJson(collRes))
122123

123-
collRes, err = cli.Database(database + "1").ListCollection(ctx)
124+
collRes, err = newCli.Database(database + "1").ListCollection(ctx)
124125
printErr(err)
125126
println(ToJson(collRes))
126127

0 commit comments

Comments
 (0)