myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [3409] trunk/app: Added relevance sorting to work


From: noreply
Subject: [myexperiment-hackers] [3409] trunk/app: Added relevance sorting to workflow, pack and file searches
Date: Thu, 7 Feb 2013 13:18:27 +0000 (UTC)

Revision
3409
Author
fbacall
Date
2013-02-07 13:18:26 +0000 (Thu, 07 Feb 2013)

Log Message

Added relevance sorting to workflow, pack and file searches

Modified Paths

Diff

Modified: trunk/app/controllers/blobs_controller.rb (3408 => 3409)


--- trunk/app/controllers/blobs_controller.rb	2013-02-07 08:56:55 UTC (rev 3408)
+++ trunk/app/controllers/blobs_controller.rb	2013-02-07 13:18:26 UTC (rev 3409)
@@ -68,6 +68,13 @@
     respond_to do |format|
       format.html {
 
+        @query = params[:query]
+        @query_type = 'files'
+        pivot_options = Conf.pivot_options.dup
+        unless @query.blank?
+          pivot_options["order"] = [{"order" => "id ASC", "option" => "relevance", "label" => "Relevance"}] + pivot_options["order"]
+        end
+
         @pivot, problem = calculate_pivot(
 
             :pivot_options  => Conf.pivot_options,
@@ -85,9 +92,6 @@
 
         flash.now[:error] = problem if problem
 
-        @query = params[:query]
-        @query_type = 'files'
-
         # index.rhtml
       }
     end

Modified: trunk/app/controllers/packs_controller.rb (3408 => 3409)


--- trunk/app/controllers/packs_controller.rb	2013-02-07 08:56:55 UTC (rev 3408)
+++ trunk/app/controllers/packs_controller.rb	2013-02-07 13:18:26 UTC (rev 3409)
@@ -30,6 +30,13 @@
     respond_to do |format|
       format.html {
 
+        @query = params[:query]
+        @query_type = 'packs'
+        pivot_options = Conf.pivot_options.dup
+        unless @query.blank?
+          pivot_options["order"] = [{"order" => "id ASC", "option" => "relevance", "label" => "Relevance"}] + pivot_options["order"]
+        end
+
         @pivot, problem = calculate_pivot(
 
             :pivot_options  => Conf.pivot_options,
@@ -47,9 +54,6 @@
 
         flash.now[:error] = problem if problem
 
-        @query = params[:query]
-        @query_type = 'packs'
-
         # index.rhtml
       }
     end

Modified: trunk/app/controllers/workflows_controller.rb (3408 => 3409)


--- trunk/app/controllers/workflows_controller.rb	2013-02-07 08:56:55 UTC (rev 3408)
+++ trunk/app/controllers/workflows_controller.rb	2013-02-07 13:18:26 UTC (rev 3409)
@@ -200,9 +200,16 @@
     respond_to do |format|
       format.html do
 
+        @query = params[:query]
+        @query_type = 'workflows'
+        pivot_options = Conf.pivot_options.dup
+        unless @query.blank?
+          pivot_options["order"] = [{"order" => "id ASC", "option" => "relevance", "label" => "Relevance"}] + pivot_options["order"]
+        end
+
         @pivot, problem = calculate_pivot(
 
-            :pivot_options  => Conf.pivot_options,
+            :pivot_options  => pivot_options,
             :params         => params,
             :user           => current_user,
             :search_models  => [Workflow],
@@ -217,9 +224,6 @@
 
         flash.now[:error] = problem if problem
 
-        @query = params[:query]
-        @query_type = 'workflows'
-
       end
       format.rss do
         address@hidden = Workflow.find(:all, :order => "updated_at DESC") # list all (if required)

Modified: trunk/app/models/blob.rb (3408 => 3409)


--- trunk/app/models/blob.rb	2013-02-07 08:56:55 UTC (rev 3408)
+++ trunk/app/models/blob.rb	2013-02-07 13:18:26 UTC (rev 3409)
@@ -32,7 +32,7 @@
 
     :mutable => [ :title, :body, :body_html ]
 
-  acts_as_solr(:fields => [:title, :local_name, :body, :kind, :contributor_name, :tag_list],
+  acts_as_solr(:fields => [{:title => {:boost => 2.0}}, :local_name, :body, :kind, :contributor_name, :tag_list],
                :include => [ :comments ]) if Conf.solr_enable
 
   belongs_to :content_blob, :dependent => :destroy

Modified: trunk/app/models/network.rb (3408 => 3409)


--- trunk/app/models/network.rb	2013-02-07 08:56:55 UTC (rev 3408)
+++ trunk/app/models/network.rb	2013-02-07 13:18:26 UTC (rev 3409)
@@ -20,7 +20,7 @@
   has_many :workflows, :as => :contributor
   has_many :policies, :as => :contributor
   
-  acts_as_solr(:fields => [ :title, :unique_name, :owner_name, :description, :tag_list ],
+  acts_as_solr(:fields => [ {:title => {:boost => 2.0}}, :unique_name, :owner_name, :description, :tag_list ],
                :include => [ :comments ]) if Conf.solr_enable
 
   format_attribute :description

Modified: trunk/app/models/pack.rb (3408 => 3409)


--- trunk/app/models/pack.rb	2013-02-07 08:56:55 UTC (rev 3408)
+++ trunk/app/models/pack.rb	2013-02-07 13:18:26 UTC (rev 3409)
@@ -37,7 +37,7 @@
   
   format_attribute :description
   
-  acts_as_solr(:fields => [ :title, :description, :contributor_name, :tag_list ],
+  acts_as_solr(:fields => [ {:title => {:boost => 2.0}}, :description, :contributor_name, :tag_list ],
                :include => [ :comments ]) if Conf.solr_enable
   
   has_many :contributable_entries,

Modified: trunk/app/models/user.rb (3408 => 3409)


--- trunk/app/models/user.rb	2013-02-07 08:56:55 UTC (rev 3408)
+++ trunk/app/models/user.rb	2013-02-07 13:18:26 UTC (rev 3409)
@@ -293,7 +293,7 @@
   
   acts_as_creditor
 
-  acts_as_solr(:fields => [ :name, :tag_list ], :include => [ :profile ], :if => "activated_at") if Conf.solr_enable
+  acts_as_solr(:fields => [ {:name => {:boost => 2.0}}, :tag_list ], :include => [ :profile ], :if => "activated_at") if Conf.solr_enable
 
   validates_presence_of :name
   

Modified: trunk/app/models/workflow.rb (3408 => 3409)


--- trunk/app/models/workflow.rb	2013-02-07 08:56:55 UTC (rev 3408)
+++ trunk/app/models/workflow.rb	2013-02-07 13:18:26 UTC (rev 3409)
@@ -59,7 +59,7 @@
     :mutable => [ :contributor, :title, :unique_name, :body, :body_html,
                   :file_ext, :last_edited_by, :content_type_id, :image, :svg ]
 
-  acts_as_solr(:fields => [ :title, :body, :filename, :tag_list, :contributor_name, :kind, :get_all_search_terms ],
+  acts_as_solr(:fields => [{:title => {:boost => 2.0}}, :body, :filename, :tag_list, :contributor_name, :kind, :get_all_search_terms ],
                :include => [ :comments ]) if Conf.solr_enable
 
   acts_as_runnable

reply via email to

[Prev in Thread] Current Thread [Next in Thread]