Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanitizing SOLR query before searching. #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

minustehbare
Copy link

I've written a gem to include a number of helper methods that can help to sanitize bad user input by either escaping special characters or removing them entirely. The gem can be found here for reference https://github.com/minustehbare/solr-search-sanitizer

Special characters are defined by the Apache Lucene Query Parser Syntax documentation here: http://lucene.apache.org/java/2_4_0/queryparsersyntax.html

Default behavior that I defined for spree-solr-search is to merely escape as much as possible. The underlying assumption for the inclusion of this gem is that users on an ecommerce website performing searches do not intend to use advanced syntax and all search terms are to be taken 'at face value'.

@rounders
Copy link

@minustehbare -- I was looking for a fix for this :-) But the use of the solr-search-sanitizer gem does not work in ruby 1.8 spree stores because of the use of the use of gsub(pattern, hash)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants