search tokenizer optimalization

This commit is contained in:
SPRINX0\prochazka
2024-12-17 10:09:52 +01:00
parent 7759fd862f
commit 2a5fdd852a
2 changed files with 8 additions and 4 deletions

View File

@@ -129,7 +129,13 @@ export function tokenizeBySearchFilter(text: string, filter: string): { text: st
res = nextres; res = nextres;
} }
return res.filter(x => x.text.length > 0); res = res.filter(x => x.text.length > 0);
if (res.length == 1 && !res[0].isMatch) {
return null;
}
return res;
// const result = []; // const result = [];
// let lastMatch = 0; // let lastMatch = 0;

View File

@@ -216,9 +216,7 @@
}} }}
/> />
<CloseSearchButton bind:filter /> <CloseSearchButton bind:filter />
{#if filter}
<DropDownButton icon="icon filter" menu={createSearchMenu} /> <DropDownButton icon="icon filter" menu={createSearchMenu} />
{/if}
{#if !filter} {#if !filter}
<DropDownButton icon="icon plus-thick" menu={createAddMenu} /> <DropDownButton icon="icon plus-thick" menu={createAddMenu} />
{/if} {/if}