diff --git a/db/util/meilisearch.go b/db/util/meilisearch.go index dd85487e..5970c9c4 100644 --- a/db/util/meilisearch.go +++ b/db/util/meilisearch.go @@ -166,6 +166,11 @@ func documentFromListRecord(r *core.Record, author *core.Record, includeShares b } } + domain := "" + if !author.GetBool("isLocal") { + domain = author.GetString("domain") + } + document := map[string]interface{}{ "id": r.Id, "author": author.Id, @@ -178,6 +183,7 @@ func documentFromListRecord(r *core.Record, author *core.Record, includeShares b "elevation_loss": totalElevationLoss, "distance": totalDistance, "duration": totalDuration, + "domain": domain, "public": r.GetBool("public"), "created": r.GetDateTime("created").Time().Unix(), "trails": trails, diff --git a/web/src/lib/stores/search_store.ts b/web/src/lib/stores/search_store.ts index 75f1ffda..8b6d0b87 100644 --- a/web/src/lib/stores/search_store.ts +++ b/web/src/lib/stores/search_store.ts @@ -27,6 +27,7 @@ export type ListSearchResult = { elevation_loss: number; distance: number, duration: number, + domain?: string, public: boolean; trails: number shares?: string[]; diff --git a/web/src/routes/+page.svelte b/web/src/routes/+page.svelte index ee384862..c5365da0 100644 --- a/web/src/routes/+page.svelte +++ b/web/src/routes/+page.svelte @@ -34,7 +34,7 @@ const actors = await searchActors(q); searchDropdownItems = actors.map((a) => ({ text: a.username, - description: `@${a.username}${a.isLocal ? "" : '@' + a.domain}`, + description: `@${a.username}${a.isLocal ? "" : "@" + a.domain}`, value: a, icon: a.icon || @@ -64,13 +64,13 @@ const trailItems = r[0].hits.map((t: TrailSearchResult) => ({ text: t.name, description: `Trail ${t.location.length ? ", " + t.location : ""}`, - value: `@${t.author}${t.domain ? `@${t.domain}` : ""}/${t.id}`, + value: `@${t.author_name}${t.domain ? `@${t.domain}` : ""}/${t.id}`, icon: "route", })); const listItems = r[1].hits.map((t: ListSearchResult) => ({ text: t.name, description: `List, ${t.trails} ${$_("trail", { values: { n: t.trails } })}`, - value: t.id, + value: `@${t.author_name}${t.domain ? `@${t.domain}` : ""}/${t.id}`, icon: "layer-group", })); const cityItems = r[2].hits.map((c: LocationSearchResult) => ({ @@ -88,7 +88,7 @@ if (item.icon == "route") { goto(`/trail/view/${item.value}`); } else if (item.icon == "layer-group") { - goto(`/lists?list=${item.value}`); + goto(`/lists/${item.value}`); } else if (item.value.username) { goto( `/profile/@${item.value.username}${item.value.isLocal ? "" : "@" + item.value.domain}`, @@ -120,6 +120,7 @@ onupdate={search} onclick={handleSearchClick} large={true} + clearAfterSelect={false} placeholder="{$_('search-for-trails-places')}..." items={searchDropdownItems} >