Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion src/collections/aggregate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { WeaviateInvalidInputError, WeaviateQueryError } from '../../errors.js';
import { Aggregator } from '../../graphql/index.js';
import { PrimitiveKeys, toBase64FromMedia } from '../../index.js';
import { Deserialize } from '../deserialize/index.js';
import { Bm25QueryProperty, NearVectorInputType, TargetVector } from '../query/types.js';
import { Bm25OperatorOptions, Bm25QueryProperty, NearVectorInputType, TargetVector } from '../query/types.js';
import { NearVectorInputGuards } from '../query/utils.js';
import { Serialize } from '../serialize/index.js';

Expand Down Expand Up @@ -45,6 +45,7 @@ export type AggregateHybridOptions<T, M, V> = AggregateBaseOptions<M> & {
queryProperties?: (PrimitiveKeys<T> | Bm25QueryProperty<T>)[];
targetVector?: TargetVector<V>;
vector?: number[];
bm25Operator?: Bm25OperatorOptions;
};

export type AggregateGroupByHybridOptions<T, M, V> = AggregateHybridOptions<T, M, V> & {
Expand Down
13 changes: 12 additions & 1 deletion src/collections/aggregate/integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */
import { requireAtLeast } from '../../../test/version.js';
import { WeaviateQueryError, WeaviateUnsupportedFeatureError } from '../../errors.js';
import weaviate, { AggregateText, WeaviateClient } from '../../index.js';
import weaviate, { AggregateText, Bm25Operator, WeaviateClient } from '../../index.js';
import { Collection } from '../collection/index.js';
import { CrossReference } from '../references/index.js';
import { DataObject } from '../types/index.js';
Expand Down Expand Up @@ -448,6 +449,16 @@ describe('Testing of collection.aggregate search methods', () => {
expect(result.totalCount).toBeGreaterThan(0);
});

requireAtLeast(1, 31, 0).it('bm25 search operator with hybrid', async () => {
const result = await collection.aggregate.hybrid('test', {
bm25Operator: Bm25Operator.and(),
maxVectorDistance: 1,
queryProperties: ['text'],
returnMetrics: collection.metrics.aggregate('text').text(['count']),
});
expect(result.totalCount).toBeGreaterThan(0);
});

it('should return a grouped aggregation on a hybrid search', async () => {
if (await client.getWeaviateVersion().then((ver) => ver.isLowerThan(1, 25, 0))) {
console.warn('Skipping test as there is a bug with this in 1.24.26 that will not be fixed');
Expand Down
Loading