Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
henomis committed Nov 2, 2023
1 parent 37efaee commit 0879110
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions index/vectordb/redis/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (d *DB) Insert(ctx context.Context, datas []index.Data) error {
documents = append(documents, document)
}

if err := d.redisearchClient.Index(documents...); err != nil {
if err = d.redisearchClient.Index(documents...); err != nil {
return fmt.Errorf("%w: %w", index.ErrInternal, err)
}

Expand All @@ -109,7 +109,7 @@ func (d *DB) Search(ctx context.Context, values []float64, options *option.Optio
}

func (d *DB) similaritySearch(
ctx context.Context,
_ context.Context,
values []float64,
opts *option.Options,
) ([]redisearch.Document, error) {
Expand All @@ -130,7 +130,7 @@ func (d *DB) similaritySearch(
return docs, err
}

func (d *DB) createIndexIfRequired(ctx context.Context) error {
func (d *DB) createIndexIfRequired(_ context.Context) error {
if d.createIndex == nil {
return nil
}
Expand Down Expand Up @@ -179,8 +179,8 @@ func buildSearchResultsFromRedisDocuments(
metadata := index.DeepCopyMetadata(match.Properties)

score := 0.0
scoreField, ok := match.Properties[defaultVectorScoreFieldName]
if ok {
scoreField, fieldExists := match.Properties[defaultVectorScoreFieldName]
if fieldExists {
scoreAsString, ok := scoreField.(string)
if ok {
score, _ = strconv.ParseFloat(scoreAsString, 64)
Expand All @@ -189,8 +189,8 @@ func buildSearchResultsFromRedisDocuments(
}

values := []float64{}
vectorField, ok := match.Properties[defaultVectorFieldName]
if ok {
vectorField, fieldExists := match.Properties[defaultVectorFieldName]
if fieldExists {
vectorAsString, ok := vectorField.(string)
if ok {
values = bytestofloat64([]byte(vectorAsString))
Expand Down

0 comments on commit 0879110

Please sign in to comment.