diff options
author | Ralph Amissah <ralph@amissah.com> | 2012-12-12 14:58:58 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2012-12-12 14:58:58 -0500 |
commit | 1beb5aa3c376dbef89bc33024216650529ef7262 (patch) | |
tree | 1682500089c14fd49bcf52a3a001e291fadd5f75 /lib/sisu/v3/cgi_sqlite.rb | |
parent | debian/changelog (3.3.2-1) (diff) | |
parent | v3: 3.3.3 version & changelog, dates touched (diff) |
Merge tag 'sisu_3.3.3' into debian/sid
Diffstat (limited to 'lib/sisu/v3/cgi_sqlite.rb')
-rw-r--r-- | lib/sisu/v3/cgi_sqlite.rb | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/sisu/v3/cgi_sqlite.rb b/lib/sisu/v3/cgi_sqlite.rb index ccb1fb50..78ae0f9a 100644 --- a/lib/sisu/v3/cgi_sqlite.rb +++ b/lib/sisu/v3/cgi_sqlite.rb @@ -141,10 +141,10 @@ module SiSU_CGI_SQLite @l,@t,@q=l,t,q 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=unescaped_search.gsub(/\s*(AND|OR)\s*/,"%' \) \\1 #{@l} LIKE \( '%"). @@ -163,12 +163,10 @@ module SiSU_CGI_SQLite 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,''). - gsub(/(doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') - search[:endnotes].flatten.each {|x| @search_endnotes << "#{x} AND " } - @search_endnotes=@search_endnotes.gsub(/AND\s+$/m,''). - gsub(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') + @search_text=search[:text].flatten.join(' AND ') + @search_text=@search_text.gsub(/(doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') + @search_endnotes=search[:endnotes].flatten.join(' AND ') + @search_endnotes=@search_endnotes.gsub(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') end WOK_SQL end |