Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(types): fields in experimental.search can be optional #2506

Merged
merged 2 commits into from Jan 17, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/module.ts
Expand Up @@ -270,7 +270,7 @@ export interface ModuleOptions {
*
* @default true
*/
indexed: boolean
indexed?: boolean
/**
* MiniSearch Options. When using `indexed` option,
* this options will be used to configure MiniSearch
Expand All @@ -293,7 +293,7 @@ export interface ModuleOptions {
*
* @see https://lucaong.github.io/minisearch/modules/_minisearch_.html#options
*/
options: MiniSearchOptions
options?: MiniSearchOptions
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/composables/search.ts
Expand Up @@ -5,7 +5,7 @@ export const defineMiniSearchOptions = <DataItem>(options: MiniSearchOptions<Dat
return ref(options)
}

export const searchContent = async <DataItem>(search: MaybeRefOrGetter<string>, options: { miniSearch?: MaybeRefOrGetter<MiniSearchOptions<DataItem>> }) => {
export const searchContent = async <DataItem>(search: MaybeRefOrGetter<string>, options: { miniSearch?: MaybeRefOrGetter<MiniSearchOptions<DataItem>> } = {}) => {
const runtimeConfig = useRuntimeConfig()
const { content } = runtimeConfig.public
const { integrity, api: { baseURL: baseAPI }, search: searchOptions } = content
Expand Down