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

Adding KNN scorer explanation #1914

Closed
wants to merge 5 commits into from
Closed

Adding KNN scorer explanation #1914

wants to merge 5 commits into from

Conversation

metonymic-smokey
Copy link
Member

@metonymic-smokey metonymic-smokey commented Nov 20, 2023

This PR adds a score Explanation to the KNN scorer, along with a unit test.
Also, contains a minor refactor of scoring related code.

@metonymic-smokey metonymic-smokey force-pushed the knn_scorer branch 2 times, most recently from f386d79 to efaeacb Compare November 20, 2023 09:26
@metonymic-smokey metonymic-smokey marked this pull request as ready for review November 20, 2023 16:29
@metonymic-smokey metonymic-smokey changed the title Adding scorer explanation Adding KNN scorer explanation Nov 20, 2023
Copy link
Member

@abhinavdangeti abhinavdangeti left a comment

Choose a reason for hiding this comment

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

Looks fine to me.
@metonymic-smokey would you add a sample snippet of the "explain score" output to the commit message here.

Also, I'm glad you've set the base branch to MB-59102 so there'd be no conflicts, but I think we should merge this into unstable after the base PR has been so we don't squash this into it and create a separate commit entry for this.

@metonymic-smokey
Copy link
Member Author

Done, pls let me know what you think.
thanks!

abhinavdangeti and others added 2 commits November 21, 2023 10:05
Includes:
* dd26ea1 Thejas-bhat | command line tool support for vector search
(#175)
* d292ef9 Thejas-bhat | replacing the flat index with the IVF family
index. (#180)
* f5e149a Thejas-bhat | bug fix: accounting the vecIDs approriately
while merging (#179)
* 0296d71 Thejas-bhat | optimization: avoiding storing of bitmaps when
vector is in a single document (#181)
* 6b9b047 Abhi Dangeti | MB-59692: Respect choice of similarity metric,
[email protected] (#182)
* e1fe4fb Abhi Dangeti | MB-59569: Upgrade to
blevesearch/[email protected] (#183)
# Jira

[MB-59102](https://issues.couchbase.com/browse/MB-59102)

## Description

When performing a MultiSearch across an alias representing a partitioned
index, we need special logic to merge the KNN results together into the
final search result.

---------

Co-authored-by: Abhinav Dangeti <[email protected]>
An error occurred while trying to automatically change base from MB-59102 to unstable November 21, 2023 17:11
An error occurred while trying to automatically change base from MB-59102 to unstable November 21, 2023 17:11
An error occurred while trying to automatically change base from MB-59102 to unstable November 21, 2023 17:11
search/scorer/scorer_knn.go Outdated Show resolved Hide resolved
search/scorer/scorer_knn.go Outdated Show resolved Hide resolved
metonymic-smokey and others added 3 commits November 21, 2023 10:34
This PR allows a user to specify a KNN Operator to determine if KNN hits
are conjuncted/disjuncted with filter query hits.
Sample explanation:
{
  "value": 0.125,
  "message": "weight(desc:query Vector^1.000000 in one), product of:",
  "children": [
    {
      "value": 0.5,
      "message": "queryWeight(desc:query Vector^1.000000), product of:",
      "children": [
        {
          "value": 1,
          "message": "boost"
        },
        {
          "value": 0.5,
          "message": "queryNorm"
        }
      ]
    },
    {
      "value": 0.25,
      "message": "fieldWeight(desc in doc one), score of:",
      "children": [
        {
          "value": 0.25,
          "message": "vector(field(desc:one) with similarity_metric(dot_product)=0.250000"
        }
      ]
    }
  ]
}
@metonymic-smokey
Copy link
Member Author

Pls review this PR instead - #1899

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

Successfully merging this pull request may close these issues.

3 participants