[Groonga-commit] ranguba/epub-searcher at 2e4302a [master] Filter by authors when authors in query

Back to archive index

KITAITI Makoto null+****@clear*****
Tue Sep 22 03:07:56 JST 2015


KITAITI Makoto	2015-09-22 03:07:56 +0900 (Tue, 22 Sep 2015)

  New Revision: 2e4302a3a0b68b2f04b1d05f4446ddd43d7fa1c1
  https://github.com/ranguba/epub-searcher/commit/2e4302a3a0b68b2f04b1d05f4446ddd43d7fa1c1

  Message:
    Filter by authors when authors in query

  Modified files:
    app/controllers/main-controller.rb

  Modified: app/controllers/main-controller.rb (+3 -3)
===================================================================
--- app/controllers/main-controller.rb    2015-09-22 03:07:09 +0900 (e7abb1e)
+++ app/controllers/main-controller.rb    2015-09-22 03:07:56 +0900 (3084dbb)
@@ -3,10 +3,10 @@ EPUBSearcher::App.controllers do
   layout :layout
   get :index do
     @query_words = params[:q]
-
-    right_query = @query_words && !@query_words.empty?
+    @authors = (params[:authors] || []).uniq
+    right_query = (@query_words && !@query_words.empty? or !@authors.empty?)
     if right_query
-      results = search_from_groonga(@query_words)
+      results = search_from_groonga(@query_words, :authors => @authors)
       @results = results.records
       @drilldowns = results.drilldowns unless results.drilldowns.empty?
       @hits = results.n_hits.to_i
-------------- next part --------------
HTML����������������������������...
다운로드 



More information about the Groonga-commit mailing list
Back to archive index