You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(using sunspot_rails 2.1.1, and sunspot_solr 2.1.1)
Suppose you have these models
class User < ActiveRecord::Base
has_many :posts
has_many :comments, through :posts
end
class Post < ActiveRecord::Base
has_many :comments
end
class Comment
searchable do
text :content
end
end
Create a few dummy comments and found this:
usr = User.first
usr.comments.count #=> 0
usr.comments.search.results.count #=> 2
In other words if you search from within a subset of comments, you still searching from all comments.
The text was updated successfully, but these errors were encountered:
JFimex
changed the title
.search method doesn't observe rails scoping
.search method ignores rails scoping
Apr 27, 2016
(using sunspot_rails 2.1.1, and sunspot_solr 2.1.1)
Suppose you have these models
class User < ActiveRecord::Base
has_many :posts
has_many :comments, through :posts
end
class Post < ActiveRecord::Base
has_many :comments
end
class Comment
searchable do
text :content
end
end
Create a few dummy comments and found this:
usr = User.first
usr.comments.count #=> 0
usr.comments.search.results.count #=> 2
In other words if you search from within a subset of comments, you still searching from all comments.
The text was updated successfully, but these errors were encountered: