Improve search for single character (#18748)
This commit is contained in:
parent
15b1d8ee14
commit
3da7025d78
|
@ -6,7 +6,7 @@ export function filterAndSort(addons: StoreAddon[], filter: string) {
|
|||
const options: IFuseOptions<StoreAddon> = {
|
||||
keys: ["name", "description", "slug"],
|
||||
isCaseSensitive: false,
|
||||
minMatchCharLength: 2,
|
||||
minMatchCharLength: Math.min(filter.length, 2),
|
||||
threshold: 0.2,
|
||||
};
|
||||
const fuse = new Fuse(addons, options);
|
||||
|
|
|
@ -249,7 +249,7 @@ class AddIntegrationDialog extends LitElement {
|
|||
"iot_standards",
|
||||
],
|
||||
isCaseSensitive: false,
|
||||
minMatchCharLength: 2,
|
||||
minMatchCharLength: Math.min(filter.length, 2),
|
||||
threshold: 0.2,
|
||||
};
|
||||
const helpers = Object.entries(h).map(([domain, integration]) => ({
|
||||
|
|
|
@ -161,7 +161,7 @@ class HaConfigIntegrationsDashboard extends SubscribeMixin(LitElement) {
|
|||
const options: IFuseOptions<ConfigEntryExtended> = {
|
||||
keys: ["domain", "localized_domain_name", "title"],
|
||||
isCaseSensitive: false,
|
||||
minMatchCharLength: 2,
|
||||
minMatchCharLength: Math.min(filter.length, 2),
|
||||
threshold: 0.2,
|
||||
};
|
||||
const fuse = new Fuse(configEntries, options);
|
||||
|
@ -205,7 +205,7 @@ class HaConfigIntegrationsDashboard extends SubscribeMixin(LitElement) {
|
|||
const options: IFuseOptions<DataEntryFlowProgressExtended> = {
|
||||
keys: ["handler", "localized_title"],
|
||||
isCaseSensitive: false,
|
||||
minMatchCharLength: 2,
|
||||
minMatchCharLength: Math.min(filter.length, 2),
|
||||
threshold: 0.2,
|
||||
};
|
||||
const fuse = new Fuse(configEntriesInProgress, options);
|
||||
|
|
|
@ -81,7 +81,7 @@ export class HuiCardPicker extends LitElement {
|
|||
const options: IFuseOptions<Card> = {
|
||||
keys: ["type", "name", "description"],
|
||||
isCaseSensitive: false,
|
||||
minMatchCharLength: filter.length === 1 ? 1 : 2,
|
||||
minMatchCharLength: Math.min(filter.length, 2),
|
||||
threshold: 0.2,
|
||||
};
|
||||
const fuse = new Fuse(cards, options);
|
||||
|
|
Loading…
Reference in New Issue