mirror of
https://github.com/discourse/discourse.git
synced 2025-01-31 04:29:29 +08:00
an attempt at getting this working on rails 4 ... not fruitful
This commit is contained in:
parent
09f9ed3609
commit
3246f066c6
|
@ -118,6 +118,9 @@ class Search
|
|||
.order("topics_month DESC")
|
||||
.secured(@guardian)
|
||||
.limit(@limit)
|
||||
if rails4?
|
||||
categories = categories.references(:category_search_data)
|
||||
end
|
||||
|
||||
categories.each do |c|
|
||||
@results.add_result(SearchResult.from_category(c))
|
||||
|
@ -130,6 +133,9 @@ class Search
|
|||
.order("CASE WHEN username_lower = '#{@original_term.downcase}' THEN 0 ELSE 1 END")
|
||||
.order("last_posted_at DESC")
|
||||
.limit(@limit)
|
||||
if rails4?
|
||||
users = users.references(:user_search_data)
|
||||
end
|
||||
|
||||
users.each do |u|
|
||||
@results.add_result(SearchResult.from_user(u))
|
||||
|
@ -143,6 +149,10 @@ class Search
|
|||
.where("topics.visible")
|
||||
.where("topics.archetype <> ?", Archetype.private_message)
|
||||
|
||||
if rails4?
|
||||
posts = posts.references(:post_search_data, {:topic => :category})
|
||||
end
|
||||
|
||||
# If we have a search context, prioritize those posts first
|
||||
if @search_context.present?
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'spec_helper'
|
||||
require 'search'
|
||||
require_dependency 'search'
|
||||
|
||||
describe Search do
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user