Module: RSolr
- Extended by:
- Char
- Defined in:
- lib/rsolr.rb,
lib/rsolr/version.rb
Defined Under Namespace
Modules: Char, Error, Response, Uri, Xml Classes: Client, Connection, HashWithResponse
Constant Summary collapse
- VERSION =
"1.0.12"
Class Method Summary collapse
- .connect(*args) ⇒ Object
-
.solr_escape(str) ⇒ String
backslash escape characters that have special meaning to Solr query parser per lucene.apache.org/core/4_0_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#Escaping_Special_Characters + - & | ! ( ) { } [ ] ^ “ ~ * ? : \ / see also svn.apache.org/repos/asf/lucene/dev/tags/lucene_solr_4_9_1/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java escapeQueryChars method.
- .version ⇒ Object
Methods included from Char
Class Method Details
.connect(*args) ⇒ Object
5 6 7 8 9 |
# File 'lib/rsolr.rb', line 5 def self.connect *args driver = Class === args[0] ? args[0] : RSolr::Connection opts = Hash === args[-1] ? args[-1] : {} Client.new driver.new, opts end |
.solr_escape(str) ⇒ String
backslash escape characters that have special meaning to Solr query parser per lucene.apache.org/core/4_0_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#Escaping_Special_Characters
+ - & | ! ( ) { } [ ] ^ " ~ * ? : \ /
escapeQueryChars method
20 21 22 23 24 |
# File 'lib/rsolr.rb', line 20 def self.solr_escape(str) # note that the gsub will parse the escaped backslashes, as will the ruby code sending the query to Solr # so the result sent to Solr is ultimately a single backslash in front of the particular character str.gsub(/([+\-&|!\(\)\{\}\[\]\^"~\*\?:\\\/])/, '\\\\\1') end |
.version ⇒ Object
4 5 6 |
# File 'lib/rsolr/version.rb', line 4 def self.version VERSION end |