diff --git a/.vscode/settings.json b/.vscode/settings.json index 6835e94..73357d6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,8 @@ { - "exportall.config.folderListener": ["/src/app/core/pipes"], + "exportall.config.folderListener": [ + "/src/app/core/pipes", + "/src/app/core/services" + ], "[typescript]": { "editor.codeActionsOnSave": { "source.organizeImports": "explicit" diff --git a/src/app/core/services/index.ts b/src/app/core/services/index.ts index 7d0165f..01c60c2 100644 --- a/src/app/core/services/index.ts +++ b/src/app/core/services/index.ts @@ -1,2 +1,4 @@ export * from './auth.service'; export * from './jwt.service'; +export * from './luoghi.service'; +export * from './utils.service'; diff --git a/src/app/core/services/luoghi.service.ts b/src/app/core/services/luoghi.service.ts new file mode 100644 index 0000000..b5d8ba7 --- /dev/null +++ b/src/app/core/services/luoghi.service.ts @@ -0,0 +1,15 @@ +export class LuoghiService { + rankLuogo(luogo: any, query: string): number { + const q = query.toLowerCase(); + const nome = luogo.luogo.toLowerCase(); + + // 1. Match perfetto (inizia per query) + if (nome.startsWith(q)) return 0; + + // 2. Match contenuto ma non all'inizio + if (nome.includes(q)) return 1; + + // 3. Nessun match diretto → meno rilevante + return 2; + } +} diff --git a/src/app/modules/public/strutture-pubbliche/strutture-pubbliche.component.html b/src/app/modules/public/strutture-pubbliche/strutture-pubbliche.component.html index 478c2ef..ec7bcc6 100644 --- a/src/app/modules/public/strutture-pubbliche/strutture-pubbliche.component.html +++ b/src/app/modules/public/strutture-pubbliche/strutture-pubbliche.component.html @@ -71,6 +71,7 @@ appendTo="body" minLength="1" [delay]="500" + scrollHeight="237px" emptyMessage="Nessun luogo trovato" [showClear]="true" class="flex-auto lg:flex-1 lg:mt-0 w-full mr-0 lg:mr-1 text-surface-900 dark:text-surface-0" @@ -86,7 +87,7 @@ #item>