I'm working on initial configuration of Sunspot under Rails 4.x. All is working well and we're experimenting to fine-tune results. We're indexing books for an online bookstore. I have the following searchable defined:
searchable do
text :full_title
text :ean
text :publisher_name
time :publication_date
text :imprint_name
double :popularity
double :avg_rating
boolean :is_featured
text :author_names do
authors.map{ |author| author.full_name }
end
end
I want "is_featured" items that match at the very top (page 1) then I want matches on titles to come before matches on publisher and author names. Within that, I wanted to order by popularity, then avg_rating. At the moment, I am trying this, but it doesn't seem right to me:
Item.search do
fulltext "pizza" do
boost_fields :full_title => 2.0
boost(3.0) { with(:is_featured, true) }
order_by(:score, :desc)
order_by(:polularity, :desc)
order_by(:avg_rating, :desc)
end
endOne other question...how does one decide on the boost factor? 2.0, 3.0, 5.0, etc.? Is this entirely an experimentation process to fine-tune? or is there a methodological way to figure out what I would want the boost factors to be?
Thanks,
Michael