我已经为我的rails应用程序实现了solr搜索。我已经将搜索字段编入索引,并且工作正常。现在我想在搜索时排除一个名为Title的特定字段。如何在搜索时跳过此特定字段。是否还有索引文本字段的排除选项。
searchable do
integer :id
boolean :searchable
boolean :premium
string :status
time :updated_at
time :created_at
###################################################
# Fulltext search fields
text :title
text :summary
text :skills
end
这里我如何只从全文搜索中删除标题字段。赞
profiles = Profile.search do |s|
s.fulltext @selected_filters[:query][:value] , exclude => :title
end
有没有办法这样做?请帮忙
答案 0 :(得分:4)
您可以在搜索中指定包含的字段
Profile.search do
keywords @selected_filters[:query][:value], :fields => [:summary, :skills], :minimum_match => 1
end