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

Add normalized_cosine vector search similarity #798

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clientlib/src/main/proto/yelp/nrtsearch/luceneserver.proto
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,8 @@ message Field {
// Byte vector : 0.5 + (dot_product(query, vector) / (32768 * dims))
// (all vectors must have the same length)
// 'cosine' : ((1 + cosine(query, vector)) / 2)
// 'normalized_cosine': Identical usage to 'cosine', but indexed and query vectors are automatically normalized
// to unit length. Original vector magnitude is available in the <field>._magnitude field.
// 'max_inner_product': when < 0 : 1 / (1 + -1 * max_inner_product(query, vector))
// when >= 0: max_inner_product(query, vector) + 1
string vectorSimilarity = 31;
Expand Down
2,575 changes: 1,304 additions & 1,271 deletions grpc-gateway/luceneserver.pb.go

Large diffs are not rendered by default.

25 changes: 24 additions & 1 deletion grpc-gateway/luceneserver.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1386,6 +1386,14 @@
"type": "integer",
"format": "int32"
},
{
"name": "liveSettings.defaultTerminateAfterMaxRecallCount",
"description": "Terminate after max recall count value to use when not specified in the search request, or 0 for none, default: 0",
"in": "query",
"required": false,
"type": "integer",
"format": "int32"
},
{
"name": "local",
"description": "When set to true, live settings changes are only applied to the local node. These changes are ephemeral,\nso will not persist through a restart. Also, the live settings returned in the response will contain the\nlocal overrides only when this flag is true.",
Expand Down Expand Up @@ -2226,6 +2234,11 @@
"type": "number",
"format": "double",
"title": "Amount of gRPC request deadline remaining at the start of search processing"
},
"loggingHitsTimeMs": {
"type": "number",
"format": "double",
"title": "Time for logging hits"
}
}
},
Expand Down Expand Up @@ -3275,7 +3288,7 @@
},
"vectorSimilarity": {
"type": "string",
"title": "Similarity type for search enabled VECTOR fields. This is a required option when search=true.\nAccepts built in types:\n 'l2_norm' : (1 / (1 + l2_norm(query, vector)^2))\n 'dot_product' : Float vector: ((1 + dot_product(query, vector)) / 2) (all vectors must be unit length)\n Byte vector : 0.5 + (dot_product(query, vector) / (32768 * dims))\n (all vectors must have the same length)\n 'cosine' : ((1 + cosine(query, vector)) / 2)\n 'max_inner_product': when \u003c 0 : 1 / (1 + -1 * max_inner_product(query, vector))\n when \u003e= 0: max_inner_product(query, vector) + 1"
"title": "Similarity type for search enabled VECTOR fields. This is a required option when search=true.\nAccepts built in types:\n 'l2_norm' : (1 / (1 + l2_norm(query, vector)^2))\n 'dot_product' : Float vector: ((1 + dot_product(query, vector)) / 2) (all vectors must be unit length)\n Byte vector : 0.5 + (dot_product(query, vector) / (32768 * dims))\n (all vectors must have the same length)\n 'cosine' : ((1 + cosine(query, vector)) / 2)\n 'normalized_cosine': Identical usage to 'cosine', but indexed and query vectors are automatically normalized\n to unit length. Original vector magnitude is available in the \u003cfield\u003e._magnitude field.\n 'max_inner_product': when \u003c 0 : 1 / (1 + -1 * max_inner_product(query, vector))\n when \u003e= 0: max_inner_product(query, vector) + 1"
},
"vectorIndexingOptions": {
"$ref": "#/definitions/luceneserverVectorIndexingOptions",
Expand Down Expand Up @@ -3899,6 +3912,11 @@
"type": "integer",
"format": "int32",
"title": "The number of documents/fields per parallel fetch task, default: 50"
},
"defaultTerminateAfterMaxRecallCount": {
"type": "integer",
"format": "int32",
"title": "Terminate after max recall count value to use when not specified in the search request, or 0 for none, default: 0"
}
},
"title": "Index live settings"
Expand Down Expand Up @@ -4234,6 +4252,11 @@
"type": "integer",
"format": "int32",
"title": "Terminate after value to use when not specified in the search request"
},
"defaultTerminateAfterMaxRecallCount": {
"type": "integer",
"format": "int32",
"description": "Terminate after max recall count value to use when not specified in the search request."
}
},
"title": "Input to liveSettings"
Expand Down
Loading
Loading