]> git.openstreetmap.org Git - nominatim.git/commitdiff
merge in the postcode and is_in terms into the address vector for search
authorBrian Quinion <openstreetmap@brian.quinion.co.uk>
Thu, 7 Feb 2013 18:38:48 +0000 (18:38 +0000)
committerBrian Quinion <openstreetmap@brian.quinion.co.uk>
Thu, 7 Feb 2013 18:41:17 +0000 (18:41 +0000)
sql/functions.sql

index 5b17f6d034a927e17460d6d9e4f692addb21bd08..fc48512859ea8b086ac8242a7b970fe630a582dd 100644 (file)
@@ -1695,8 +1695,15 @@ BEGIN
         FOR i IN 1..array_upper(isin, 1) LOOP
           address_street_word_id := get_name_id(make_standard_name(isin[i]));
           IF address_street_word_id IS NOT NULL AND NOT(ARRAY[address_street_word_id] <@ isin_tokens) THEN
+            nameaddress_vector := array_merge(nameaddress_vector, ARRAY[address_street_word_id]);
             isin_tokens := isin_tokens || address_street_word_id;
           END IF;
+
+          -- merge word into address vector
+          address_street_word_id := get_word_id(make_standard_name(isin[i]));
+          IF address_street_word_id IS NOT NULL THEN
+            nameaddress_vector := array_merge(nameaddress_vector, ARRAY[address_street_word_id]);
+          END IF;
         END LOOP;
       END IF;
     END IF;
@@ -1706,8 +1713,15 @@ BEGIN
         FOR i IN 1..array_upper(isin, 1) LOOP
           address_street_word_id := get_name_id(make_standard_name(isin[i]));
           IF address_street_word_id IS NOT NULL AND NOT(ARRAY[address_street_word_id] <@ isin_tokens) THEN
+            nameaddress_vector := array_merge(nameaddress_vector, ARRAY[address_street_word_id]);
             isin_tokens := isin_tokens || address_street_word_id;
           END IF;
+
+          -- merge into address vector
+          address_street_word_id := get_word_id(make_standard_name(isin[i]));
+          IF address_street_word_id IS NOT NULL THEN
+            nameaddress_vector := array_merge(nameaddress_vector, ARRAY[address_street_word_id]);
+          END IF;
         END LOOP;
       END IF;
     END IF;
@@ -1718,6 +1732,10 @@ BEGIN
         address_street_word_id := get_name_id(make_standard_name(location.postcode));
         nameaddress_vector := array_merge(nameaddress_vector, ARRAY[address_street_word_id]);
         isin_tokens := isin_tokens || address_street_word_id;
+
+        -- also merge in the single word version
+        address_street_word_id := get_word_id(make_standard_name(location.postcode));
+        nameaddress_vector := array_merge(nameaddress_vector, ARRAY[address_street_word_id]);
       END LOOP;
     END IF;