[open-ils-commits] r8888 - trunk/Open-ILS/src/sql/Pg

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Mar 6 21:19:16 EST 2008


Author: miker
Date: 2008-03-06 20:46:42 -0500 (Thu, 06 Mar 2008)
New Revision: 8888

Modified:
   trunk/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
Log:
adding alias qualifier to support more than one search class

Modified: trunk/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/300.schema.staged_search.sql	2008-03-06 21:03:04 UTC (rev 8887)
+++ trunk/Open-ILS/src/sql/Pg/300.schema.staged_search.sql	2008-03-07 01:46:42 UTC (rev 8888)
@@ -172,21 +172,21 @@
                       ORDER BY id
                       LIMIT 1;
 
-                    tmp_text := 'value ILIKE ' || quote_literal( tmp_text || '%' );
+                    tmp_text := query_part.table_alias || '.value ILIKE ' || quote_literal( tmp_text || '%' );
 
                 ELSIF rank_adjust.bump_type = 'word_order' THEN
                     SELECT  array_to_string( array_accum( term ), '%' ) INTO tmp_text
                       FROM  search.parse_search_args(param_searches)
                       WHERE table_alias = query_part.table_alias AND term_type = 'word';
 
-                    tmp_text := 'value ILIKE ' || quote_literal( '%' || tmp_text || '%' );
+                    tmp_text := query_part.table_alias || '.value ILIKE ' || quote_literal( '%' || tmp_text || '%' );
 
                 ELSIF rank_adjust.bump_type = 'full_match' THEN
                     SELECT  array_to_string( array_accum( term ), E'\\s+' ) INTO tmp_text
                       FROM  search.parse_search_args(param_searches)
                       WHERE table_alias = query_part.table_alias AND term_type = 'word';
 
-                    tmp_text := 'value  ~ ' || quote_literal( '^' || tmp_text || E'\\W*$' );
+                    tmp_text := query_part.table_alias || '.value  ~ ' || quote_literal( '^' || tmp_text || E'\\W*$' );
 
                 END IF;
 
@@ -209,7 +209,7 @@
               WHERE term_type = 'phrase'
                     AND table_alias = query_part.table_alias LOOP
 
-            inner_where_clause := inner_where_clause || ' AND ' || 'value  ~* ' || quote_literal( E'(^|\\W+)' || regexp_replace(phrase_query_part.term, E'\\s+',E'\\\\s+','g') || E'(\\W+|\$)' );
+            inner_where_clause := inner_where_clause || ' AND ' || query_part.table_alias || '.value  ~* ' || quote_literal( E'(^|\\W+)' || regexp_replace(phrase_query_part.term, E'\\s+',E'\\\\s+','g') || E'(\\W+|\$)' );
 
         END LOOP;
 



More information about the open-ils-commits mailing list