aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/cgi_pgsql.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v3/cgi_pgsql.rb')
-rw-r--r--lib/sisu/v3/cgi_pgsql.rb18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/sisu/v3/cgi_pgsql.rb b/lib/sisu/v3/cgi_pgsql.rb
index f78f65f5..1264d922 100644
--- a/lib/sisu/v3/cgi_pgsql.rb
+++ b/lib/sisu/v3/cgi_pgsql.rb
@@ -75,7 +75,7 @@ module SiSU_CGI_PgSQL
available_db_table=`psql --list` # system call requires psql
available_db=available_db_table.scan(/(#{Db[:name_prefix]}\S+)/) if not available_db_table.nil?
if available_db \
- and available_db.class==Array
+ and available_db.is_a?(Array)
available_db.flatten.each do |x|
serve << x.gsub(/#{Db[:name_prefix]}(\S+)/,'\1')
end
@@ -144,10 +144,10 @@ module SiSU_CGI_PgSQL
@l,@t,@q,@c=l,t,q,cse
end
def string
- search={ :search => [], :flag => false }
+ search={ search: [], flag: false }
if @t =~/\S+/ or @q =~/\S+/
- if @t =~/\S+/; unescaped_search=CGI.unescape(@t)
- elsif @q =~/\S+/; unescaped_search=CGI.unescape(@q)
+ if @t =~/\S+/ then unescaped_search=CGI.unescape(@t)
+ elsif @q =~/\S+/ then unescaped_search=CGI.unescape(@q)
end
search_construct=[]
unescaped_search=if @c
@@ -171,12 +171,10 @@ module SiSU_CGI_PgSQL
def search_query1
<<-'WOK_SQL'
@search_text,@search_endnotes='',''
- search[:text].flatten.each {|x| @search_text << "#{x} AND " }
- @search_text=@search_text.gsub(/AND\s+$/m,''). #watch
- gsub(/(doc_objects\.clean~[*]?\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean~[*]?\(\s*'[^']+'\s*\))+)/,'(\1)')
- search[:endnotes].flatten.each {|x| @search_endnotes << "#{x} AND " }
- @search_endnotes=@search_endnotes.gsub(/AND\s+$/m,''). #watch
- gsub(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)')
+ @search_text=search[:text].flatten.join(' AND ')
+ @search_text=@search_text.gsub(/(doc_objects\.clean~[*]?\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean~[*]?\(\s*'[^']+'\s*\))+)/,'(\1)')
+ @search_endnotes=search[:endnotes].flatten.join(' AND ')
+ @search_endnotes=@search_endnotes.gsub(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)')
end
WOK_SQL
end