From: miker Date: Fri, 7 Mar 2008 01:46:42 +0000 (+0000) Subject: adding alias qualifier to support more than one search class X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=e327e09c5251dc0a67648cf3f68d5978c7b43255;p=Evergreen.git adding alias qualifier to support more than one search class git-svn-id: svn://svn.open-ils.org/ILS/trunk@8888 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/sql/Pg/300.schema.staged_search.sql b/Open-ILS/src/sql/Pg/300.schema.staged_search.sql index 36db30e381..347afd11b1 100644 --- a/Open-ILS/src/sql/Pg/300.schema.staged_search.sql +++ b/Open-ILS/src/sql/Pg/300.schema.staged_search.sql @@ -172,21 +172,21 @@ BEGIN 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 @@ BEGIN 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;