Conversation
CascadingRadium
requested changes
Feb 3, 2026
abhinavdangeti
requested changes
Feb 13, 2026
| options |= index.SkipFreqNorm | ||
|
|
||
| if vectorIndexOptimizedFor == index.IndexOptimizedWithBivfFlat { | ||
| similarity = index.CosineSimilarity |
Member
There was a problem hiding this comment.
Add commentary here, that this is for the backing index - as as default to hamming distance with Bivf.
| vectorIndexOptimizedFor = index.DefaultIndexOptimization | ||
| } | ||
| // BIVF-Flat index needs cosine similarity for correct scoring | ||
| // regardless of the similarity metric specified in the mapping. |
Member
There was a problem hiding this comment.
Update to indicate that this is for the backing flat (ditto above)
| vectorIndexOptimizedFor = index.DefaultIndexOptimization | ||
| } | ||
| // BIVF-Flat index needs cosine similarity for correct scoring | ||
| // regardless of the similarity metric specified in the mapping. |
| effectiveOptimizedFor = index.DefaultIndexOptimization | ||
| } | ||
| if effectiveOptimizedFor == index.IndexOptimizedWithBivfFlat && field.Dims%8 != 0 { | ||
| return fmt.Errorf("field: '%s', vector dimensions for bivf-flat must be a multiple"+ |
Member
There was a problem hiding this comment.
Update this to the same message - use a const for here and below. Maybe use - "incompatible vector dimensionality for BQ".
| // BIVF-Flat index optimization requires vector dimensions to be a multiple of 8 | ||
| if effectiveOptimizedFor == index.IndexOptimizedWithBivfFlat && field.Dims%8 != 0 { | ||
| return fmt.Errorf("field: '%s', invalid vector dimension: %d for optimization with BIVF-Flat,"+ | ||
| " dimension should be a multiple of 8", effectiveFieldName, field.Dims) |
| return nil, fmt.Errorf("k must be greater than 0 and vector must be non-empty") | ||
| } | ||
| if fieldMapping.VectorIndexOptimizedFor == index.IndexOptimizedWithBivfFlat { | ||
| similarityMetric = index.CosineSimilarity |
Member
There was a problem hiding this comment.
Related to comment earlier.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.