[ActiveContext] Refactor Query
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Context
ActiveContext::Query.knn
When calling ::ActiveContext::Query.filter(...).knn, the knn method requires a limit parameter. This refers to the k nearest neighbors in knn, but this could be misunderstood as a search results limit. In order to prevent confusion, we should rename this parameter to k.
Proposal
- Rename knn
limitargument tok - Update documentation for ^
- Add an instance method for
filterquery so that it can be called as this example - Add documentation for ^
Example of using filter instance method.
base_query = ::ActiveContext::Query.knn(
target: current_embeddings_field,
vector: target_embeddings,
limit: KNN_COUNT
)
project_ids.each do |project_id|
query = base_query.filter(
project_id: project_id
)
end
Edited by 🤖 GitLab Bot 🤖