Skip to content

Commit 0791917

Browse files
chore: cleanup docs and tests related to vector query (#2199)
1 parent fda53d2 commit 0791917

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

dev/src/reference/query.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ export class Query<
620620
* // Returns the closest 10 documents whose Euclidean distance from their 'embedding' fields are closed to [41, 42].
621621
* const vectorQuery = col.findNearest('embedding', [41, 42], {limit: 10, distanceMeasure: 'EUCLIDEAN'});
622622
*
623-
* const querySnapshot = await aggregateQuery.get();
623+
* const querySnapshot = await vectorQuery.get();
624624
* querySnapshot.forEach(...);
625625
* ```
626626
*

dev/system-test/firestore.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -2382,7 +2382,7 @@ describe('Query class', () => {
23822382
});
23832383

23842384
describe('requesting computed distance', () => {
2385-
it('supports COSINE distance', async () => {
2385+
it('supports requesting computed COSINE distance', async () => {
23862386
const indexTestHelper = new IndexTestHelper(firestore);
23872387

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

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

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

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

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

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

25442544
const collectionReference = await indexTestHelper.setTestDocs({
@@ -2579,7 +2579,7 @@ describe('Query class', () => {
25792579
});
25802580

25812581
describe('querying with distance threshold', () => {
2582-
it('supports COSINE distance', async () => {
2582+
it('supports querying with distance threshold using COSINE distance', async () => {
25832583
const indexTestHelper = new IndexTestHelper(firestore);
25842584

25852585
const collectionReference = await indexTestHelper.setTestDocs({
@@ -2613,7 +2613,7 @@ describe('Query class', () => {
26132613
).to.be.true;
26142614
});
26152615

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

26192619
const collectionReference = await indexTestHelper.setTestDocs({
@@ -2647,7 +2647,7 @@ describe('Query class', () => {
26472647
.to.be.true;
26482648
});
26492649

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

26532653
const collectionReference = await indexTestHelper.setTestDocs({
@@ -2680,7 +2680,7 @@ describe('Query class', () => {
26802680
).to.be.true;
26812681
});
26822682

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

26862686
const collectionReference = await indexTestHelper.setTestDocs({

dev/test/vector-query.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ describe('Vector(findNearest) query interface', () => {
224224
.isEqual(
225225
queryB.findNearest({
226226
vectorField: 'embedding',
227-
queryVector: [40, 42],
227+
queryVector: [40, 41, 42],
228228
distanceMeasure: 'COSINE',
229229
limit: 1000,
230230
})

0 commit comments

Comments
 (0)