mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-10 10:56:34 +00:00
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> = {
|
const options: IFuseOptions<StoreAddon> = {
|
||||||
keys: ["name", "description", "slug"],
|
keys: ["name", "description", "slug"],
|
||||||
isCaseSensitive: false,
|
isCaseSensitive: false,
|
||||||
minMatchCharLength: 2,
|
minMatchCharLength: Math.min(filter.length, 2),
|
||||||
threshold: 0.2,
|
threshold: 0.2,
|
||||||
};
|
};
|
||||||
const fuse = new Fuse(addons, options);
|
const fuse = new Fuse(addons, options);
|
||||||
|
@ -249,7 +249,7 @@ class AddIntegrationDialog extends LitElement {
|
|||||||
"iot_standards",
|
"iot_standards",
|
||||||
],
|
],
|
||||||
isCaseSensitive: false,
|
isCaseSensitive: false,
|
||||||
minMatchCharLength: 2,
|
minMatchCharLength: Math.min(filter.length, 2),
|
||||||
threshold: 0.2,
|
threshold: 0.2,
|
||||||
};
|
};
|
||||||
const helpers = Object.entries(h).map(([domain, integration]) => ({
|
const helpers = Object.entries(h).map(([domain, integration]) => ({
|
||||||
|
@ -161,7 +161,7 @@ class HaConfigIntegrationsDashboard extends SubscribeMixin(LitElement) {
|
|||||||
const options: IFuseOptions<ConfigEntryExtended> = {
|
const options: IFuseOptions<ConfigEntryExtended> = {
|
||||||
keys: ["domain", "localized_domain_name", "title"],
|
keys: ["domain", "localized_domain_name", "title"],
|
||||||
isCaseSensitive: false,
|
isCaseSensitive: false,
|
||||||
minMatchCharLength: 2,
|
minMatchCharLength: Math.min(filter.length, 2),
|
||||||
threshold: 0.2,
|
threshold: 0.2,
|
||||||
};
|
};
|
||||||
const fuse = new Fuse(configEntries, options);
|
const fuse = new Fuse(configEntries, options);
|
||||||
@ -205,7 +205,7 @@ class HaConfigIntegrationsDashboard extends SubscribeMixin(LitElement) {
|
|||||||
const options: IFuseOptions<DataEntryFlowProgressExtended> = {
|
const options: IFuseOptions<DataEntryFlowProgressExtended> = {
|
||||||
keys: ["handler", "localized_title"],
|
keys: ["handler", "localized_title"],
|
||||||
isCaseSensitive: false,
|
isCaseSensitive: false,
|
||||||
minMatchCharLength: 2,
|
minMatchCharLength: Math.min(filter.length, 2),
|
||||||
threshold: 0.2,
|
threshold: 0.2,
|
||||||
};
|
};
|
||||||
const fuse = new Fuse(configEntriesInProgress, options);
|
const fuse = new Fuse(configEntriesInProgress, options);
|
||||||
|
@ -81,7 +81,7 @@ export class HuiCardPicker extends LitElement {
|
|||||||
const options: IFuseOptions<Card> = {
|
const options: IFuseOptions<Card> = {
|
||||||
keys: ["type", "name", "description"],
|
keys: ["type", "name", "description"],
|
||||||
isCaseSensitive: false,
|
isCaseSensitive: false,
|
||||||
minMatchCharLength: filter.length === 1 ? 1 : 2,
|
minMatchCharLength: Math.min(filter.length, 2),
|
||||||
threshold: 0.2,
|
threshold: 0.2,
|
||||||
};
|
};
|
||||||
const fuse = new Fuse(cards, options);
|
const fuse = new Fuse(cards, options);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user