Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Only fetch required fields from search

  • Loading branch information...
commit 41997d5e7e24457fa5f8ba4330d64f087c82018e 1 parent 89b8920
Ryan Daigle authored October 12, 2012
3  app/models/gist.rb
@@ -55,9 +55,10 @@ def search(user, q)
55 55
           log({ns: self, fn: __method__, query: q, measure: true}, user) do
56 56
             tire.search do
57 57
               query { string q }
  58
+              fields [:description, :url, :public, :gh_updated_at, :id]
58 59
               # sort { by :gh_created_at, 'desc' }
59 60
               filter :term, :user_id => user.id
60  
-              highlight :description, :'files.content', :options => { :tag => "<b>" }
  61
+              highlight :description, :options => { :tag => "<em>" }
61 62
               size 15
62 63
             end
63 64
           end
1  app/views/gists/search.html.haml
@@ -10,6 +10,7 @@
10 10
     - for result in @results
11 11
       %li
12 12
         %p= search_result_link(result)
  13
+        / %p= result.inspect
13 14
         / %p.files= files_display(result)
14 15
         / - if(result.highlight && result.highlight[:'files.content'])
15 16
         /   - highlights = result.highlight[:'files.content']

0 notes on commit 41997d5

Please sign in to comment.
Something went wrong with that request. Please try again.