|
1 | 1 | /* eslint-disable @typescript-eslint/no-non-null-assertion */
|
2 | 2 | /* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */
|
| 3 | +import { requireAtLeast } from '../../../test/version.js'; |
3 | 4 | import { WeaviateUnsupportedFeatureError } from '../../errors.js';
|
4 | 5 | import weaviate, { WeaviateClient } from '../../index.js';
|
5 | 6 | import { Collection } from '../collection/index.js';
|
6 | 7 | import { CrossReference, Reference } from '../references/index.js';
|
7 | 8 | import { GroupByOptions } from '../types/index.js';
|
| 9 | +import { Bm25Operator } from './utils.js'; |
8 | 10 |
|
9 | 11 | describe('Testing of the collection.query methods with a simple collection', () => {
|
10 | 12 | let client: WeaviateClient;
|
@@ -132,6 +134,32 @@ describe('Testing of the collection.query methods with a simple collection', ()
|
132 | 134 | expect(ret.objects[0].uuid).toEqual(id);
|
133 | 135 | });
|
134 | 136 |
|
| 137 | + requireAtLeast( |
| 138 | + 1, |
| 139 | + 31, |
| 140 | + 0 |
| 141 | + )('bm25 search operator (minimum_should_match)', () => { |
| 142 | + it('should query with bm25 + operator', async () => { |
| 143 | + const ret = await collection.query.bm25('carrot', { |
| 144 | + limit: 1, |
| 145 | + operator: Bm25Operator.or({ minimumMatch: 1 }), |
| 146 | + }); |
| 147 | + expect(ret.objects.length).toEqual(1); |
| 148 | + expect(ret.objects[0].properties.testProp).toEqual('carrot'); |
| 149 | + expect(ret.objects[0].uuid).toEqual(id); |
| 150 | + }); |
| 151 | + |
| 152 | + it('should query with hybrid + bm25Operator', async () => { |
| 153 | + const ret = await collection.query.hybrid('carrot', { |
| 154 | + limit: 1, |
| 155 | + bm25Operator: Bm25Operator.and(), |
| 156 | + }); |
| 157 | + expect(ret.objects.length).toEqual(1); |
| 158 | + expect(ret.objects[0].properties.testProp).toEqual('carrot'); |
| 159 | + expect(ret.objects[0].uuid).toEqual(id); |
| 160 | + }); |
| 161 | + }); |
| 162 | + |
135 | 163 | it('should query with hybrid and vector', async () => {
|
136 | 164 | const ret = await collection.query.hybrid('carrot', {
|
137 | 165 | limit: 1,
|
|
0 commit comments