Skip to content

Commit

Permalink
feat: add getVectorSearchDocumentsQuery and extraBundles constants
Browse files Browse the repository at this point in the history
  • Loading branch information
tupac-rocher-smile committed Dec 15, 2023
1 parent f271dc3 commit c124f35
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/shared/src/constants/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,29 @@ export function getSearchDocumentsQuery(
})
}

export function getVectorSearchDocumentsQuery(
entityType: string,
filter: IDocumentFieldFilterInput | IDocumentFieldFilterInput[] = null,
withAggregations = false
): string {
const documentQueryContent = getSearchDocumentQueryContent(
filter,
withAggregations,
entityType
)
return jsonToGraphQLQuery({
query: {
__name: 'getVectorSearchDocuments',
__variables: { ...documentQueryContent.variables },
vectorSearchDocuments: {
__aliasFor: 'vectorSearchDocuments',
__args: { ...documentQueryContent.args },
...documentQueryContent.fields,
},
},
})
}

export function getSearchDocumentQueryContent(
filter: IDocumentFieldFilterInput | IDocumentFieldFilterInput[] = null,
withAggregations = false,
Expand Down
4 changes: 4 additions & 0 deletions packages/shared/src/types/documents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export interface IGraphqlSearchDocuments {
documents: IGraphqlSearchDocument
}

export interface IGraphqlVectorSearchDocuments {
vectorSearchDocuments: IGraphqlSearchDocument
}

export interface IGraphqlSearchDocument {
collection: IGraphqlDocument[]
paginationInfo: IGraphqlDocumentPaginationInfo
Expand Down
3 changes: 3 additions & 0 deletions packages/shared/src/types/extraBundle.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
export enum Bundle {
VIRTUAL_CATEGORY = 'GallyVirtualCategoryBundle',
BOOST = 'GallyBoostBundle',
THESAURUS = 'GallyThesaurusBundle',
VECTOR_SEARCH = 'GallyVectorSearchBundle',
}

export interface IExtraBundle {
Expand Down

0 comments on commit c124f35

Please sign in to comment.