- Repository: http://github.com/boffbowsh/rack-search_terms
Rack::SearchTerms gives your app access to the search terms that drove the visitor to your site. Simply grab env['search_terms']
in your Rack app and you're away!
Add to your Gemfile:
gem 'rack-search_terms'
In config/environment.rb, add:
config.middleware.use "Rack::SearchTerms"
Just use Rack::SearchTerms
as any other middleware.
Our use case for this is to help our 404 page. If someone is referred from a Search Engine to an unknown page (it happens!), then we do a lookup against our internal search engine and hopefully return what the user was looking for.
You could also use it to highlight search terms within your page, but this isn't advised ;)
I encourage you to:
- Fork the project.
- Make your feature addition, bug fix, or support for additional search engine.
- Add specs for it.
- Send me a pull request. Bonus points for topic branches.
Maintained by Paul Bowsher
Thanks to Bryan Helmkamp for the Quick Start section of this README :)
See MIT-LICENSE.txt in this directory.