Permalink
Browse files

favorites should fully work again. along with major application.js issue

  • Loading branch information...
starmandell committed May 11, 2012
1 parent 220b130 commit 17df671393827b38417f3a0b9307696d782ef5db
Showing with 7 additions and 5 deletions.
  1. +0 −2 app/controllers/application_controller.rb
  2. +7 −3 app/controllers/lessons_controller.rb
@@ -37,8 +37,6 @@ def check_sort(params)
end
def create_result_items(q, sort)
- puts "light monster"
- puts $index.inspect
$index.search(q, :function => sort, :snippet => 'text',
:len => 30,
:fetch => 'title, author, desc, timestamp, author_id, tags, text',
@@ -120,12 +120,16 @@ def search
def favorites
sort = check_sort(params[:score].to_i)
lesson_ids = FavoriteRelationship.where(:user_id => current_user).map(&:lesson_id)
- flash[:info ] = lesson_ids
q_params = ''
lesson_ids.each do |i|
q_params << i.to_s + ' OR '
end
- q = 'docid: '+q_params[0..-5]
- @result_items = create_result_items(q, sort)
+ if q_params.empty?
+ #q = 'docid: -1'
+ @result_items = []
+ else
+ q = 'docid:('+q_params[0..-5]+')'
+ @result_items = create_result_items(q, sort)
+ end
end
end

0 comments on commit 17df671

Please sign in to comment.