This commit is contained in:
2025-11-17 14:37:50 -03:00
parent d2abaec021
commit 7f41704d90
51 changed files with 733 additions and 495 deletions

View File

@@ -1,15 +1,21 @@
import { Meilisearch, type SearchResponse } from 'meilisearch'
const MAX_HITS_PER_PAGE = 100
export async function createSearch({
query,
filter = undefined,
index,
page,
hitsPerPage,
sort,
env
}: {
query?: string
filter?: string
index: string
page?: number
hitsPerPage: number
sort: string[]
env: Env
}): Promise<SearchResponse> {
@@ -21,6 +27,8 @@ export async function createSearch({
return index_.search(query, {
sort,
filter,
limit: 100
page,
hitsPerPage:
hitsPerPage > MAX_HITS_PER_PAGE ? MAX_HITS_PER_PAGE : hitsPerPage
})
}