的文档more_like_this显示了如何使用它来获取更多基于标准的相似类型的内容:
class Post < ActiveRecord::Base
searchable do
# The :more_like_this option must be set to true
text :body, :more_like_this => true
end
end
post = Post.first
results = Sunspot.more_like_this(post) do
fields :body
minimum_term_frequency 5
end
我想知道是否可以返回不同数据类型的相关项目。例如,Videos与 相关/相似Articles。
我想这取决于more_like_this是按照“基于一组标准的更多与Articles此Article相似的事物”的方式运行,还是按照“基于一组标准的更多与此相似的事物Article”的方式运行。 ..
我的用例是,如果我正在显示Article, 并且我想在页面的一侧显示相关内容 - 可能是 other Articles、Videos同一类别或Events相关主题等的内容。