开发者

Using sunspot_rails with rails

开发者 https://www.devze.com 2023-04-04 04:58 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消