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

chore: cleanup docs and tests related to vector query #2199

Merged
merged 23 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
72ca7c0
API layer changes for vector distance.
MarkDuckworth Jul 26, 2024
a27ed4b
Staging protos
MarkDuckworth Jul 26, 2024
ce3c99e
Tests and formatting.
MarkDuckworth Jul 26, 2024
33a31d7
Docs and more tests.
MarkDuckworth Jul 26, 2024
7220612
Revert "Staging protos"
MarkDuckworth Aug 12, 2024
fb72c64
Merge branch 'main' of github.com:googleapis/nodejs-firestore into ma…
MarkDuckworth Aug 12, 2024
6d065c8
upgrade deps
MarkDuckworth Aug 12, 2024
3ac9126
Refactor and additional test updates
MarkDuckworth Aug 14, 2024
d07641f
VectorQuery.isEqual fixes and tests
MarkDuckworth Aug 14, 2024
85a598b
add files
MarkDuckworth Aug 14, 2024
a042509
Update types in firestore.d.ts
MarkDuckworth Aug 14, 2024
6ccf5ae
Updated sample for findNearest documentation.
MarkDuckworth Aug 14, 2024
873dd12
Test distanceResultField with select query
MarkDuckworth Aug 14, 2024
33b1cf8
Rename VectorQueryOptions to FindNearestOptions for cross-SDK consist…
MarkDuckworth Aug 21, 2024
a3d8c91
Merge branch 'main' into markduckworth/vector-distance
MarkDuckworth Aug 27, 2024
bd2cb93
Rename FindNearestOptions to VectorQueryOptions
MarkDuckworth Sep 4, 2024
e1d5f62
add missing import
MarkDuckworth Sep 4, 2024
7083fd3
Fixed import
MarkDuckworth Sep 5, 2024
afa3120
Doc and test name updates
MarkDuckworth Sep 26, 2024
cde00c2
Merge branch 'main' of github.com:googleapis/nodejs-firestore into ma…
MarkDuckworth Sep 26, 2024
046126f
Merge branch 'main' into markduckworth/vector-distance
MarkDuckworth Oct 3, 2024
4d7e7fb
Merge branch 'main' into markduckworth/vector-distance
MarkDuckworth Oct 3, 2024
87af661
Merge branch 'main' into markduckworth/vector-distance
MarkDuckworth Dec 3, 2024
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: 1 addition & 1 deletion dev/src/reference/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ export class Query<
* // Returns the closest 10 documents whose Euclidean distance from their 'embedding' fields are closed to [41, 42].
* const vectorQuery = col.findNearest('embedding', [41, 42], {limit: 10, distanceMeasure: 'EUCLIDEAN'});
*
* const querySnapshot = await aggregateQuery.get();
* const querySnapshot = await vectorQuery.get();
* querySnapshot.forEach(...);
* ```
*
Expand Down
16 changes: 8 additions & 8 deletions dev/system-test/firestore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2382,7 +2382,7 @@ describe('Query class', () => {
});

describe('requesting computed distance', () => {
it('supports COSINE distance', async () => {
it('supports requesting computed COSINE distance', async () => {
const indexTestHelper = new IndexTestHelper(firestore);

const collectionReference = await indexTestHelper.setTestDocs({
Expand Down Expand Up @@ -2419,7 +2419,7 @@ describe('Query class', () => {
expect(res.docs[3].get('distance')).to.equal(2);
});

it('supports EUCLIDEAN distance', async () => {
it('supports requesting computed EUCLIDEAN distance', async () => {
const indexTestHelper = new IndexTestHelper(firestore);

const collectionReference = await indexTestHelper.setTestDocs({
Expand Down Expand Up @@ -2463,7 +2463,7 @@ describe('Query class', () => {
expect(res.docs[3].get('distance')).to.equal(100);
});

it('supports DOT_PRODUCT distance', async () => {
it('supports requesting computed DOT_PRODUCT distance', async () => {
const indexTestHelper = new IndexTestHelper(firestore);

const collectionReference = await indexTestHelper.setTestDocs({
Expand Down Expand Up @@ -2538,7 +2538,7 @@ describe('Query class', () => {
expect(res.docs[0].get('distance')).to.equal(1);
});

it('supports select queries', async () => {
it('supports requesting computed distance in select queries', async () => {
const indexTestHelper = new IndexTestHelper(firestore);

const collectionReference = await indexTestHelper.setTestDocs({
Expand Down Expand Up @@ -2579,7 +2579,7 @@ describe('Query class', () => {
});

describe('querying with distance threshold', () => {
it('supports COSINE distance', async () => {
it('supports querying with distance threshold using COSINE distance', async () => {
const indexTestHelper = new IndexTestHelper(firestore);

const collectionReference = await indexTestHelper.setTestDocs({
Expand Down Expand Up @@ -2613,7 +2613,7 @@ describe('Query class', () => {
).to.be.true;
});

it('supports EUCLIDEAN distance', async () => {
it('supports querying with distance threshold using EUCLIDEAN distance', async () => {
const indexTestHelper = new IndexTestHelper(firestore);

const collectionReference = await indexTestHelper.setTestDocs({
Expand Down Expand Up @@ -2647,7 +2647,7 @@ describe('Query class', () => {
.to.be.true;
});

it('supports DOT_PRODUCT distance', async () => {
it('supports querying with distance threshold using DOT_PRODUCT distance', async () => {
const indexTestHelper = new IndexTestHelper(firestore);

const collectionReference = await indexTestHelper.setTestDocs({
Expand Down Expand Up @@ -2680,7 +2680,7 @@ describe('Query class', () => {
).to.be.true;
});

it('works with distance threshold', async () => {
it('works with distance result field', async () => {
const indexTestHelper = new IndexTestHelper(firestore);

const collectionReference = await indexTestHelper.setTestDocs({
Expand Down
2 changes: 1 addition & 1 deletion dev/test/vector-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ describe('Vector(findNearest) query interface', () => {
.isEqual(
queryB.findNearest({
vectorField: 'embedding',
queryVector: [40, 42],
queryVector: [40, 41, 42],
distanceMeasure: 'COSINE',
limit: 1000,
})
Expand Down
Loading