开发者

Searching with Sunspot returns all results in db

开发者 https://www.devze.com 2023-03-12 12:46 出处:网络
Inside StreamPage i have defined this code for searching searchable do text :html, :stored => true, :boost => 2

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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号