Searching with Sunspot returns all results in db
Inside StreamPage i have defined this code for searching
searchable do
text :html, :stored => true, :boost => 2
integer :stream_id
end
I have 44 record and used reindex on this setting
s = StreamPage.search do |st|
st.keywords 'fsdgsfdgdffsdfgsfdgfd'
end
So even when i run above code i get all rec开发者_如何学Cords, anything i write into keyword i get the result.
Something is probably off with your search statement. Have you tried using this syntax?
s = StreamPage.search { keywords('fsdgsfdgdffsdfgsfdgfd') }
My guess is that the use of the st
local variable is messing things up. I would also verify that everything has been properly indexed by running this command:
bin/rake sunspot:reindex
精彩评论