Module: CouchRest::Search::Escape
- Included in:
- Database, Model::Base
- Defined in:
- lib/couchrest_model_search.rb
Instance Method Summary collapse
Instance Method Details
#escape_special_characters(query) ⇒ Object
72 73 74 75 76 |
# File 'lib/couchrest_model_search.rb', line 72 def escape_special_characters(query) new_query = query.dup lucene_special_characters.map {|c| new_query.gsub!(c, %{\\} + c)} new_query end |
#lucene_special_characters ⇒ Object
78 79 80 |
# File 'lib/couchrest_model_search.rb', line 78 def lucene_special_characters @lucene_special_characters ||= %w[\ + - && || ! ( ) { } [ ] ^ " ~ * ? :] end |