High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix(server): penalize null geodata fields when searching places (#8408)
Mert5bc915872430
diff --git a/server/src/queries/search.repository.sql b/server/src/queries/search.repository.sqlindex c7b6600681..e985a1a6d7 100644--- a/server/src/queries/search.repository.sql+++ b/server/src/queries/search.repository.sql@@ -254,15 +254,15 @@ WHEREOR f_unaccent ("admin1Name") %>> f_unaccent ($1)OR f_unaccent ("alternateNames") %>> f_unaccent ($1)ORDER BY- COALESCE(f_unaccent (name) <->>> f_unaccent ($1), 0) + COALESCE(+ COALESCE(f_unaccent (name) <->>> f_unaccent ($1), 0.1) + COALESCE(f_unaccent ("admin2Name") <->>> f_unaccent ($1),- 0+ 0.1) + COALESCE(f_unaccent ("admin1Name") <->>> f_unaccent ($1),- 0+ 0.1) + COALESCE(f_unaccent ("alternateNames") <->>> f_unaccent ($1),- 0+ 0.1) ASCLIMIT20diff --git a/server/src/repositories/search.repository.ts b/server/src/repositories/search.repository.tsindex 2de48b7415..4530d2295f 100644--- a/server/src/repositories/search.repository.ts+++ b/server/src/repositories/search.repository.ts@@ -214,10 +214,10 @@ export class SearchRepository implements ISearchRepository {.orWhere(`f_unaccent("alternateNames") %>> f_unaccent(:placeName)`).orderBy(`- COALESCE(f_unaccent(name) <->>> f_unaccent(:placeName), 0) +- COALESCE(f_unaccent("admin2Name") <->>> f_unaccent(:placeName), 0) +- COALESCE(f_unaccent("admin1Name") <->>> f_unaccent(:placeName), 0) +- COALESCE(f_unaccent("alternateNames") <->>> f_unaccent(:placeName), 0)+ COALESCE(f_unaccent(name) <->>> f_unaccent(:placeName), 0.1) ++ COALESCE(f_unaccent("admin2Name") <->>> f_unaccent(:placeName), 0.1) ++ COALESCE(f_unaccent("admin1Name") <->>> f_unaccent(:placeName), 0.1) ++ COALESCE(f_unaccent("alternateNames") <->>> f_unaccent(:placeName), 0.1)`,).setParameters({ placeName })