Using sunspot_rails with rails
I'm writing a rails app that allows people to submit links and titles a little bit like reddit.
I want to make 开发者_开发知识库it so that people can enter a url and find the record with a similar url. This gets tricky if people leave off the http:// at the beginning or do or don't have the trailing "/".
How do I set that up using Solr/Sunspot?
If I've understand your query properly, there are a couple of problems combined here.
You can probably use something like URI.parse(incoming_url) and then extract the relevant parts of the URL that you want. I'd then use that info and convert it to a slug using something like slugify or acts_as_slug.
I'm not sure why you want to tie that functionality into Sunspot though.
精彩评论