diff options
author | Ralph Amissah <ralph@amissah.com> | 2012-10-01 16:39:32 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2012-10-01 16:39:32 -0400 |
commit | 610573c495420ebf3661e9e1829405179d8e6aa3 (patch) | |
tree | 27edb7591eced09f4b373acef68c20033bb9bfea /lib/sisu/v3/cgi_pgsql.rb | |
parent | v3: db, book_idx field & minor re-arrangement (diff) |
v3: cgi search script, minor
Diffstat (limited to 'lib/sisu/v3/cgi_pgsql.rb')
-rw-r--r-- | lib/sisu/v3/cgi_pgsql.rb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/sisu/v3/cgi_pgsql.rb b/lib/sisu/v3/cgi_pgsql.rb index 83a1cecf..1264d922 100644 --- a/lib/sisu/v3/cgi_pgsql.rb +++ b/lib/sisu/v3/cgi_pgsql.rb @@ -144,7 +144,7 @@ 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+/ then unescaped_search=CGI.unescape(@t) elsif @q =~/\S+/ then unescaped_search=CGI.unescape(@q) @@ -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 |