Skip to content

Commit

Permalink
Merge branch 'feat/optimize-log-message' into 'main' (merge request !69)
Browse files Browse the repository at this point in the history
feat: optimize log message
  • Loading branch information
rogersqsliu committed Dec 23, 2024
2 parents 67bedb9 + d5ed38b commit 92d7770
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## v1.5.3
* fix: optimize warning message for modifing vector indexes interface

## v1.5.2
* fix: optimize the interface modifing vector indexes

Expand Down
2 changes: 1 addition & 1 deletion tcvdbtext/encoder/bm25_encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (bm25 *BM25Encoder) SetDefaultParams(bm25Language string) error {
}
defer file.Close()

log.Printf("[Waring] start to download dictionary %v and store it in %v, please wait a moment",
log.Printf("[Warning] start to download dictionary %v and store it in %v, please wait a moment",
bm25ParamsUrl, fileStoragePath)
resp, err := http.Get(bm25ParamsUrl)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions tcvdbtext/tokenizer/jieba_tokenizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func NewJiebaTokenizer(params *TokenizerParams) (Tokenizer, error) {
defaultStopWordFilePath := dir + STOP_WORD_PATH

if params == nil {
log.Printf("[Waring] Jieba will use default file for stopwords, which is %v", defaultStopWordFilePath)
log.Printf("[Warning] Jieba will use default file for stopwords, which is %v", defaultStopWordFilePath)
jbt.StopWordsFilePath = defaultStopWordFilePath
err := jbt.Jieba.LoadStop(defaultStopWordFilePath)
if err != nil {
Expand Down Expand Up @@ -76,7 +76,7 @@ func NewJiebaTokenizer(params *TokenizerParams) (Tokenizer, error) {
if ok {
jbt.StopWordsEnable = stopWordsEnable
if stopWordsEnable {
log.Printf("[Waring] Jieba will use default file for stopwords, which is %v", defaultStopWordFilePath)
log.Printf("[Warning] Jieba will use default file for stopwords, which is %v", defaultStopWordFilePath)
jbt.StopWordsFilePath = defaultStopWordFilePath
err := jbt.Jieba.LoadStop(defaultStopWordFilePath)
if err != nil {
Expand Down Expand Up @@ -206,7 +206,7 @@ func (jbt *JiebaTokenizer) UpdateParameters(params TokenizerParams) error {
dir := filepath.Dir(filePath)
defaultStopWordFilePath := dir + STOP_WORD_PATH

log.Printf("[Waring] Jieba will use default file for stopwords, which is %v", defaultStopWordFilePath)
log.Printf("[Warning] Jieba will use default file for stopwords, which is %v", defaultStopWordFilePath)
jbt.StopWordsFilePath = defaultStopWordFilePath
err := jbt.Jieba.LoadStop(defaultStopWordFilePath)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion tcvectordb/ai_document_sets.go
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ func (i *implementerAIDocumentSets) loadAndSplitTextCheckParams(param *LoadAndSp
isMarkdown = true
}
if !isMarkdown && param.SplitterPreprocess.ChunkSplitter != nil && *param.SplitterPreprocess.ChunkSplitter != "" {
log.Printf("[Waring] %s", "param SplitterPreprocess.ChunkSplitter will be ommitted, "+
log.Printf("[Warning] %s", "param SplitterPreprocess.ChunkSplitter will be ommitted, "+
"because only markdown filetype supports defining ChunkSplitter")
}

Expand Down
2 changes: 1 addition & 1 deletion tcvectordb/base_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ func optionParamsFromIndexParams(column *api.IndexColumn, v IndexParams) {
column.Params.Nlist = param.NList
}
default:
log.Printf("[Waring] Unknown type: %v", reflect.TypeOf(v))
log.Printf("[Warning] unknown type: %v", reflect.TypeOf(v))
}

}
Expand Down
4 changes: 3 additions & 1 deletion tcvectordb/base_index_flat.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tcvectordb

import (
"context"
"log"

"github.com/tencent/vectordatabase-sdk-go/tcvectordb/api"
"github.com/tencent/vectordatabase-sdk-go/tcvectordb/api/index"
Expand Down Expand Up @@ -147,10 +148,11 @@ func (i *implementerFlatIndex) ModifyVectorIndex(ctx context.Context, databaseNa
}
req.RebuildRules = param.RebuildRules

res := new(index.ModifyVectorIndexReq)
res := new(index.ModifyVectorIndexRes)
err := i.Request(ctx, req, res)
if err != nil {
return err
}
log.Println("[Warning]", res.Msg)
return nil
}
2 changes: 1 addition & 1 deletion tcvectordb/rpc_base_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ func optionRpcParamsFromIndexParams(column *olama.IndexColumn, v IndexParams) {
column.Params.Nlist = param.NList
}
default:
log.Printf("[Waring] Unknown type: %v", reflect.TypeOf(v))
log.Printf("[Warning] unknown type: %v", reflect.TypeOf(v))
}
}

Expand Down
6 changes: 5 additions & 1 deletion tcvectordb/rpc_base_index_flat.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tcvectordb

import (
"context"
"log"

"github.com/tencent/vectordatabase-sdk-go/tcvectordb/olama"
)
Expand Down Expand Up @@ -111,9 +112,12 @@ func (r *rpcImplementerFlatIndex) ModifyVectorIndex(ctx context.Context, databas
req.RebuildRules.Throttle = defaultThrottle
}

_, err := r.rpcClient.ModifyVectorIndex(ctx, req)
res, err := r.rpcClient.ModifyVectorIndex(ctx, req)
if err != nil {
return err
}
if res != nil {
log.Println("[Warning]", res.Msg)
}
return nil
}
2 changes: 1 addition & 1 deletion tcvectordb/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@

package tcvectordb

const SDKVersion = "v1.5.2"
const SDKVersion = "v1.5.3"

0 comments on commit 92d7770

Please sign in to comment.