[Mapbender-commits] r8197 - trunk/mapbender/resources/db/pgsql/UTF-8/update

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Nov 9 09:21:01 EST 2011


Author: armin11
Date: 2011-11-09 06:21:00 -0800 (Wed, 09 Nov 2011)
New Revision: 8197

Modified:
   trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.2_to_2.7.3_pgsql_UTF-8.sql
Log:
Allow searching for mapbender ids for layer and wms over fulltext search

Modified: trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.2_to_2.7.3_pgsql_UTF-8.sql
===================================================================
--- trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.2_to_2.7.3_pgsql_UTF-8.sql	2011-11-08 14:10:35 UTC (rev 8196)
+++ trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.2_to_2.7.3_pgsql_UTF-8.sql	2011-11-09 14:21:00 UTC (rev 8197)
@@ -115,3 +115,41 @@
 $BODY$
   LANGUAGE plpgsql VOLATILE;
 
+-- Function: f_collect_searchtext(integer, integer)
+
+-- DROP FUNCTION f_collect_searchtext(integer, integer);
+
+CREATE OR REPLACE FUNCTION f_collect_searchtext(integer, integer)
+  RETURNS text AS
+$BODY$DECLARE
+    p_wms_id ALIAS FOR $1;
+    p_layer_id ALIAS FOR $2;
+    
+    r_keywords RECORD;
+    l_result TEXT;
+BEGIN
+    l_result := '';
+    l_result := l_result || (SELECT COALESCE(wms_title, '') || ' ' || COALESCE(wms_abstract, '')  || ' ' || wms_id::text FROM wms WHERE wms_id = p_wms_id);
+    l_result := l_result || (SELECT COALESCE(layer_name, '')|| ' ' || COALESCE(layer_title, '')  || ' ' || COALESCE(layer_abstract, '') || ' ' || layer_id::text FROM layer WHERE layer_id = p_layer_id);
+    FOR r_keywords IN SELECT DISTINCT keyword FROM
+        (SELECT keyword FROM layer_keyword L JOIN keyword K ON (K.keyword_id = L.fkey_keyword_id AND L.fkey_layer_id = p_layer_id)
+        ) AS __keywords__ LOOP
+        l_result := l_result || ' ' || COALESCE(r_keywords.keyword, '');
+    END LOOP;
+    FOR r_keywords IN SELECT DISTINCT md_topic_category_code_de FROM
+        (SELECT md_topic_category_code_de FROM md_topic_category T JOIN layer_md_topic_category C ON (C.fkey_md_topic_category_id = T.md_topic_category_id AND C.fkey_layer_id = p_layer_id)
+        ) AS __keywords__ LOOP
+        l_result := l_result || ' ' || COALESCE(r_keywords.md_topic_category_code_de, '');
+    END LOOP;
+   l_result := UPPER(l_result);
+   l_result := replace(replace(replace(replace(replace(replace(replace(l_result,'Ä','AE'),'ß','SS'),'Ö','OE'),'Ü','UE'),'ä','AE'),'ü','UE'),'ö','OE');
+
+    RETURN l_result;
+END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE STRICT
+  COST 100;
+
+
+
+



More information about the Mapbender_commits mailing list