views:

69

answers:

1

I'm new to Solr search and trying to get a grasp on how to handle ordering of results. I'm using Ruby on Rails together with the Sunspot gem to interface with Solr.

I have an Article model, that has the following fields that are indexed:

text Title
text AuthorNames
integer NumberOfReviews

I'd like to be able to perform a search on Solr where:

  • Exact title matches are returned before anything else
  • Positive weighting is given proportionally to Articles with a larger NumberOfReviews

Ideally, I'd also like to be able to do something like Google where near misses and typos are also found to a certain extent, and alternative searches are suggested when it seems like the user might have made a mistake, though I'm not sure this is possible.

Can anyone help or point me in the right direction? Thanks in advance!

+4  A: 
  1. "Weighting" is usually called "boosting" in Solr/Lucene jargon.
  2. Take a look at dismax queries and its parameters, there's a lot of tuning you can do there. For example you can use the bf parameter to boost articles with larger NumberOfReviews.
  3. Mistake checking, alternative suggestions: see SpellCheckComponent
Mauricio Scheffer