From 77f646410e09ab8cff9e039d5e1ef297f503a704 Mon Sep 17 00:00:00 2001 From: Brian Quinion Date: Tue, 22 May 2012 19:43:49 +0200 Subject: [PATCH] deal with some indexing edge cases --- sql/functions.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sql/functions.sql b/sql/functions.sql index 777d20d0..3168b338 100644 --- a/sql/functions.sql +++ b/sql/functions.sql @@ -1225,7 +1225,7 @@ DECLARE result BOOLEAN; BEGIN - IF NEW.indexed_status != 0 OR OLD.indexed_status = 0 THEN + IF NEW.indexed_status != 0 OR OLD.indexed_status = 0 OR NEW.linked_place_id is not null THEN RETURN NEW; END IF; @@ -1256,7 +1256,7 @@ BEGIN RETURN NEW; END IF; - IF OLD.indexed_status > 1 THEN + IF OLD.indexed_status > 0 THEN result := deleteSearchName(NEW.partition, NEW.place_id); DELETE FROM place_addressline WHERE place_id = NEW.place_id; DELETE FROM place_boundingbox where place_id = NEW.place_id; @@ -1630,7 +1630,7 @@ BEGIN location_rank_search := 100; location_distance := 0; -- RAISE WARNING ' getNearFeatures(%,''%'',%,''%'')',NEW.partition, place_centroid, search_maxrank, isin_tokens; - FOR location IN SELECT * from getNearFeatures(NEW.partition, place_centroid, search_maxrank, isin_tokens) LOOP + FOR location IN SELECT distinct * from getNearFeatures(NEW.partition, place_centroid, search_maxrank, isin_tokens) LOOP --RAISE WARNING ' AREA: %',location; @@ -1662,7 +1662,7 @@ BEGIN FOR i IN 1..array_upper(isin_tokens, 1) LOOP --RAISE WARNING ' getNearestNamedFeature: % % % %',NEW.partition, place_centroid, search_maxrank, isin_tokens[i]; - FOR location IN SELECT * from getNearestNamedFeature(NEW.partition, place_centroid, search_maxrank, isin_tokens[i]) LOOP + FOR location IN SELECT distinct * from getNearestNamedFeature(NEW.partition, place_centroid, search_maxrank, isin_tokens[i]) LOOP --RAISE WARNING ' ISIN: %',location; -- 2.39.5