]> git.openstreetmap.org Git - nominatim.git/blobdiff - sql/functions.sql
prefer English wikipedia for wikidata matches
[nominatim.git] / sql / functions.sql
index 0903356713799a22a94716367b39bc2a3b9e955f..9a78887be3f4c1cbe984087bc9c005729c599666 100644 (file)
@@ -2703,7 +2703,7 @@ BEGIN
   IF extratags ? 'wikidata' THEN
     FOR match IN SELECT * FROM wikipedia_article
                   WHERE wd_page_title = extratags->'wikidata'
-                  ORDER BY importance DESC limit 1 LOOP
+                  ORDER BY language = 'en' DESC, langcount DESC LIMIT 1 LOOP
       result.importance := match.importance;
       result.wikipedia := match.language || ':' || match.title;
       RETURN result;