KITAITI Makoto
null+****@clear*****
Thu Dec 25 03:42:43 JST 2014
KITAITI Makoto 2014-12-25 03:42:43 +0900 (Thu, 25 Dec 2014) New Revision: 30c89f21eadcd0721c56593c808dfdfd5a605f56 https://github.com/ranguba/epub-searcher/commit/30c89f21eadcd0721c56593c808dfdfd5a605f56 Message: Use RemoteDatabase to search words on Padrino app It's better to share implementation to connect to Droonga between web app and command-line app. Modified files: app/app.rb Modified: app/app.rb (+7 -8) =================================================================== --- app/app.rb 2014-12-25 03:42:28 +0900 (668cf39) +++ app/app.rb 2014-12-25 03:42:43 +0900 (515440b) @@ -59,23 +59,22 @@ module EPUBSearcher # def search_from_groonga(query_words) - records = nil options = { protocol: :http, host: settings.droonga_host, - port: settings.droonga_port, + port: settings.droonga_port } - Groonga::Client.open(options) do |client| - select = client.select( + db = RemoteDatabase.new(options) + begin + db.select( :table => :Books, :query => query_words, :match_columns => 'author,title,main_text', - :output_columns => 'author,title,snippet_html(main_text)', - :command_version => 2, + :output_columns => 'author,title,snippet_html(main_text)' ) - records = select.records + ensure + db.close end - records end end -------------- next part -------------- HTML����������������������������...Télécharger