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

feat: add es8 indexer&retriever #41

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Conversation

BytePender
Copy link
Contributor

No description provided.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

license-eye has totally checked 179 files.

Valid Invalid Ignored Fixed
157 22 0 0
Click to see the invalid file list
  • components/indexer/es8/field_mapping/consts.go
  • components/indexer/es8/field_mapping/field_mapping.go
  • components/indexer/es8/internal/consts.go
  • components/indexer/es8/consts.go
  • components/indexer/es8/indexer.go
  • components/indexer/es8/indexer_test.go
  • components/indexer/es8/utils.go
  • components/retriever/es8/field_mapping/consts.go
  • components/retriever/es8/field_mapping/mapping.go
  • components/retriever/es8/internal/consts.go
  • components/retriever/es8/search_mode/approximate.go
  • components/retriever/es8/search_mode/approximate_test.go
  • components/retriever/es8/search_mode/dense_vector_similarity.go
  • components/retriever/es8/search_mode/dense_vector_similarity_test.go
  • components/retriever/es8/search_mode/exact_match.go
  • components/retriever/es8/search_mode/interface.go
  • components/retriever/es8/search_mode/raw_string.go
  • components/retriever/es8/search_mode/sparse_vector_text_expansion.go
  • components/retriever/es8/search_mode/sparse_vector_text_expansion_test.go
  • components/retriever/es8/search_mode/utils.go
  • components/retriever/es8/consts.go
  • components/retriever/es8/retriever.go

components/indexer/es8/consts.go Show resolved Hide resolved
components/indexer/es8/field_mapping/consts.go Outdated Show resolved Hide resolved
components/indexer/es8/field_mapping/field_mapping.go Outdated Show resolved Hide resolved
components/indexer/es8/indexer.go Show resolved Hide resolved
components/indexer/es8/indexer_test.go Show resolved Hide resolved
components/retriever/es8/search_mode/interface.go Outdated Show resolved Hide resolved
components/retriever/es8/search_mode/utils.go Show resolved Hide resolved
Copy link

go-test-coverage report:

No coverage report available ```

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

license-eye has totally checked 174 files.

Valid Invalid Ignored Fixed
164 10 0 0
Click to see the invalid file list
  • components/retriever/es8/search_mode/approximate.go
  • components/retriever/es8/search_mode/approximate_test.go
  • components/retriever/es8/search_mode/dense_vector_similarity.go
  • components/retriever/es8/search_mode/dense_vector_similarity_test.go
  • components/retriever/es8/search_mode/exact_match.go
  • components/retriever/es8/search_mode/raw_string.go
  • components/retriever/es8/search_mode/sparse_vector_text_expansion.go
  • components/retriever/es8/search_mode/sparse_vector_text_expansion_test.go
  • components/retriever/es8/search_mode/utils.go
  • components/retriever/es8/option.go

components/retriever/es8/option.go Show resolved Hide resolved
// QueryFieldName the name of query field, required when using Hybrid
QueryFieldName string
// VectorFieldName the name of the vector field to search against, required
VectorFieldName string
Copy link
Contributor Author

Choose a reason for hiding this comment

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

QueryFieldName 和 VectorFieldName 分别怎么理解?

Copy link
Contributor

Choose a reason for hiding this comment

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

QueryFieldName 代表 query 对应的 field 名称
VectorFieldName 代表 query 通过 embedding 生成的 vector 对应的 field 名称

@N3kox N3kox force-pushed the feat/es8_retriever branch 4 times, most recently from ad8060a to 1b7e6dd Compare January 13, 2025 12:09
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

license-eye has totally checked 180 files.

Valid Invalid Ignored Fixed
179 1 0 0
Click to see the invalid file list
  • components/retriever/es8/search_mode/raw_string_test.go

@N3kox N3kox force-pushed the feat/es8_retriever branch from 1b7e6dd to da0e449 Compare January 13, 2025 12:13

var chunks [][]T
for size < len(slice) {
slice, chunks = slice[size:], append(chunks, slice[0:size:size])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

slice[0:size:size] 这里 slice 切片时,指定 cap 的用意是啥

if err = bi.Add(ctx, item); err != nil {
return nil, err
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个地方有 bi.Add 进行批量添加, 是不是少一个 执行的步骤?

Copy link
Contributor

Choose a reason for hiding this comment

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

BulkIndexer 内部会定期 flush,下面的 Close 方法也会 flush

tuples := make([]tuple[string, int], 0, len(fields))
texts := make([]string, 0, len(fields))
for k, text := range needEmbeddingFields {
tuples = append(tuples, tuple[string, int]{k, len(texts)})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

tuple 这个语义应该是 pair

Copy link
Contributor Author

Choose a reason for hiding this comment

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

texts 变量中, 长度为啥使用 fields, 而不是 needEmbeddingFields?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

len(texts) 表达的是这个 tuple 对应在 texts 中的位置?

}

for _, t := range tuples {
fields[t.A] = vectors[t.B]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

原来 fields 中的 value 应该是啥, 是不是不应该更改 fields 这个 map[string]any

}
}

b, err := json.Marshal(fields)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

看是否需要把 json 换乘 sonic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants