Module: RSolr
- Defined in:
- lib/rsolr.rb,
lib/rsolr/field.rb,
lib/rsolr/version.rb,
lib/rsolr/document.rb,
lib/rsolr/generator.rb
Defined Under Namespace
Modules: Array, Char, Error, JSON, Response, Uri, Xml Classes: Client, DateField, DateTimeField, Document, DocumentField, Field, Generator, HashWithResponse, TimeField
Constant Summary collapse
- VERSION =
"2.6.0"
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
Class Method Details
.connect(*args) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/rsolr.rb', line 16 def self.connect *args opts = args.pop if args.last.is_a?(::Hash) opts ||= {} connection = args.first Client.new connection, 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
31 32 33 34 35 |
# File 'lib/rsolr.rb', line 31 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 |