diff --git a/frontend/src/components/editor-page/app-bar/cheatsheet/cheatsheet-search.tsx b/frontend/src/components/editor-page/app-bar/cheatsheet/cheatsheet-search.tsx index 228ffad2c..80f13ada7 100644 --- a/frontend/src/components/editor-page/app-bar/cheatsheet/cheatsheet-search.tsx +++ b/frontend/src/components/editor-page/app-bar/cheatsheet/cheatsheet-search.tsx @@ -12,7 +12,7 @@ import { UiIcon } from '../../../common/icons/ui-icon' import type { CheatsheetSingleEntry, CheatsheetExtension } from '../../cheatsheet/cheatsheet-extension' import { hasCheatsheetTopics } from '../../cheatsheet/cheatsheet-extension' import styles from './cheatsheet.module.scss' -import type { IndexOptionsForDocumentSearch } from 'flexsearch-ts' +import type { IndexOptionsForDocumentSearch, StoreOption } from 'flexsearch-ts' import React, { useCallback, useEffect, useMemo, useState } from 'react' import { FormControl, InputGroup } from 'react-bootstrap' import { X } from 'react-bootstrap-icons' @@ -24,7 +24,7 @@ interface CheatsheetSearchIndexEntry extends SearchIndexEntry { example: string } -const searchOptions: IndexOptionsForDocumentSearch = { +const searchOptions: IndexOptionsForDocumentSearch = { document: { id: 'id', field: ['title', 'description', 'example'] diff --git a/frontend/src/hooks/common/use-document-search.ts b/frontend/src/hooks/common/use-document-search.ts index 05d30aae6..10d8cd168 100644 --- a/frontend/src/hooks/common/use-document-search.ts +++ b/frontend/src/hooks/common/use-document-search.ts @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import type { IndexOptionsForDocumentSearch, Id, SimpleDocumentSearchResultSetUnit } from 'flexsearch-ts' +import type { IndexOptionsForDocumentSearch, Id, SimpleDocumentSearchResultSetUnit, StoreOption } from 'flexsearch-ts' import { Document } from 'flexsearch-ts' import { useEffect, useMemo, useState } from 'react' @@ -21,12 +21,12 @@ export interface SearchIndexEntry { */ export const useDocumentSearch = ( entries: Array, - options: IndexOptionsForDocumentSearch, + options: IndexOptionsForDocumentSearch, searchTerm: string ): SimpleDocumentSearchResultSetUnit[] => { const [results, setResults] = useState([]) const searchIndex = useMemo(() => { - const index = new Document({ + const index = new Document({ tokenize: 'full', ...options })