mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 20:38:52 +00:00
fix(core): better search result (#12015)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Simplified search menu logic by removing unnecessary filtering and parameters from menu item generation. No changes to visible functionality. - **Bug Fixes** - Improved search index matching to retrieve all relevant entries, enhancing search accuracy. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -2,7 +2,6 @@ import type {
|
||||
CollectionMeta,
|
||||
TagMeta,
|
||||
} from '@affine/core/components/page-list';
|
||||
import { fuzzyMatch } from '@affine/core/utils/fuzzy-match';
|
||||
import { I18n } from '@affine/i18n';
|
||||
import { createSignalFromObservable } from '@blocksuite/affine/shared/utils';
|
||||
import type { DocMeta } from '@blocksuite/affine/store';
|
||||
@@ -108,8 +107,7 @@ export class SearchMenuService extends Service {
|
||||
...meta,
|
||||
highlights,
|
||||
},
|
||||
action,
|
||||
query
|
||||
action
|
||||
);
|
||||
})
|
||||
.filter(m => !!m);
|
||||
@@ -184,8 +182,7 @@ export class SearchMenuService extends Service {
|
||||
|
||||
private toDocMenuItem(
|
||||
meta: DocMetaWithHighlights,
|
||||
action: SearchDocMenuAction,
|
||||
query?: string
|
||||
action: SearchDocMenuAction
|
||||
): LinkedMenuItem | null {
|
||||
const title = this.docDisplayMetaService.title$(meta.id, {
|
||||
reference: true,
|
||||
@@ -195,10 +192,6 @@ export class SearchMenuService extends Service {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (query && !fuzzyMatch(title, query)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
name: meta.highlights ? html`${unsafeHTML(meta.highlights)}` : title,
|
||||
key: meta.id,
|
||||
|
||||
Reference in New Issue
Block a user