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

MB-59863: Vector validation, compliant to bleve_index_api@v1.1.4 #15

Merged
merged 7 commits into from
Dec 1, 2023

Conversation

abhinavdangeti
Copy link
Member

@abhinavdangeti abhinavdangeti commented Nov 29, 2023

Given that sear can only ever hold a single document, the VectorReader here will only
make sure that the field is available in the document and that the dimensions set for it
matches that of the query vector.

Copy link

github-actions bot commented Nov 29, 2023

Pull Request Test Coverage Report for Build 7040379617

  • 6 of 12 (50.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.9%) to 89.326%

Changes Missing Coverage Covered Lines Changed/Added Lines %
doc.go 2 8 25.0%
Totals Coverage Status
Change from base Build 3463391211: -0.9%
Covered Lines: 477
Relevant Lines: 534

💛 - Coveralls

@abhinavdangeti abhinavdangeti force-pushed the vectors branch 2 times, most recently from ecc2f49 to 2724d4d Compare November 29, 2023 23:58
@abhinavdangeti abhinavdangeti changed the title Vector validation support, compliant to new bleve_index_api interfaces MB-59863: Vector validation support, compliant to new bleve_index_api interfaces Nov 29, 2023
@abhinavdangeti abhinavdangeti changed the title MB-59863: Vector validation support, compliant to new bleve_index_api interfaces MB-59863: Vector validation, compliant to new bleve_index_api interfaces Nov 29, 2023
@abhinavdangeti abhinavdangeti changed the title MB-59863: Vector validation, compliant to new bleve_index_api interfaces MB-59863: Vector validation, compliant to bleve_index_api@v1.1.3 Nov 30, 2023
@@ -29,6 +29,7 @@ type Document struct {
fieldNames []string
fieldTokenFreqs []index.TokenFrequencies
fieldLens []int
vectorDims []int // applicable to vector fields only
Copy link
Member

Choose a reason for hiding this comment

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

i didn't understand why the datatype for the vectorDims is an []int instead of int. is it for like per field?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because there can be multiple vector fields over which multi knn can be run :)

Copy link
Member

Choose a reason for hiding this comment

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

yeah and with respect to non-vector fields it will be zero right?

Copy link
Member Author

Choose a reason for hiding this comment

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

correct, we don't allow vector fields with dims = 0 anyway - so should be good there.

v.done = true
return nil, nil
}
return v.Next(preAlloced)
Copy link
Member

Choose a reason for hiding this comment

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

this is more of a doubt/minor detail. is it a good pattern to invoke a Next() call inside an Advance() function? since they are two different things in iterators design/principle - although i realize there aren't any iterators in this reader. it seems a little odd to me that we are invoking Next and Advance concepts which are related to iterators on a non-iterative object - more specifically invoking Next() inside of Advance().

Copy link
Member Author

@abhinavdangeti abhinavdangeti Nov 30, 2023

Choose a reason for hiding this comment

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

This is a single document index - so there're no other moves to make here :)
See TermFieldReader in term.go, you'll notice the same maneuver.

}

func (v *VectorFieldReader) Size() int {
return 0
Copy link
Member

@Thejas-bhat Thejas-bhat Nov 30, 2023

Choose a reason for hiding this comment

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

i'm not sure if i follow this is bit (so could you please clarify this) - is it supposed to be no-op? like shouldn't it be like a static size of the struct VectorFieldReader?

Copy link
Member Author

Choose a reason for hiding this comment

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

During validation we don't really care about this, just a no-op. See TermFieldReader also.

@abhinavdangeti abhinavdangeti changed the title MB-59863: Vector validation, compliant to bleve_index_api@v1.1.3 MB-59863: Vector validation, compliant to bleve_index_api@v1.1.4 Nov 30, 2023
@abhinavdangeti abhinavdangeti merged commit f87cc79 into master Dec 1, 2023
10 checks passed
@abhinavdangeti abhinavdangeti deleted the vectors branch December 1, 2023 16:15
ns-codereview pushed a commit to couchbase/n1fty that referenced this pull request Dec 1, 2023
Also, move up bleve@unstable

Requires: blevesearch/sear#15

Change-Id: Ie1ba3573f4ed754ea7a91f51ba93bc959d466ce1
Reviewed-on: https://review.couchbase.org/c/n1fty/+/201928
Tested-by: Abhi Dangeti <abhinav@couchbase.com>
Reviewed-by: Abhi Dangeti <abhinav@couchbase.com>
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.

2 participants