update
This commit is contained in:
@@ -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
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user