-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
PHPORM-277 Add Builder::vectorSearch()
#3242
Conversation
Builder::vectorSearch()
tests/AtlasSearchTest.php
Outdated
); | ||
} | ||
|
||
/** Generate random vectors */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment would benefit from noting that you're using a fixed seed to make the tests deterministic.
Also, am I correct in assuming the vector4
generation here pertains to How to Ingest Pre-Quantized Vectors in the Atlas docs? That may be worth referencing as well.
{ | ||
srand(1); | ||
foreach ($items as &$item) { | ||
$this->vectors[] = $item['vector4'] = array_map(fn () => rand() / mt_getrandmax(), range(0, 3)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider leaving a TODO to revisit this once PHPC-2474 is implemented. It looks like that ticket entails more than just adding a new subtype constant, as there are utility functions to convert to/from vectors (as described in the corresponding spec).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure for the todo, I create a ticket to add support in the aggregation builder first. https://jira.mongodb.org/browse/PHPLIB-1603
Fix PHPORM-277
Adding the field
vectorSearchScore
by default, as this is a helpful and presented in the documentation.For tests, the vectors are generated randomly, using a fixed seed.
Checklist