solr-ruby 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/solr/document.rb +1 -1
- data/lib/solr/importer/mapper.rb +1 -1
- data/lib/solr/request/dismax.rb +1 -1
- data/lib/solr/request/index_info.rb +3 -0
- data/lib/solr/response/add_document.rb +1 -1
- data/lib/solr/response/index_info.rb +1 -1
- data/lib/solr/response/ping.rb +1 -1
- data/lib/solr/response/ruby.rb +1 -1
- data/lib/solr/response/standard.rb +1 -1
- data/lib/solr/response/xml.rb +1 -1
- data/lib/solr/util.rb +1 -7
- data/test/unit/document_test.rb +4 -0
- metadata +3 -3
data/lib/solr/document.rb
CHANGED
@@ -37,7 +37,7 @@ class Solr::Document
|
|
37
37
|
case fields
|
38
38
|
when Hash
|
39
39
|
fields.each_pair do |name,value|
|
40
|
-
if value.respond_to?(:each)
|
40
|
+
if value.respond_to?(:each) && !value.is_a?(String)
|
41
41
|
value.each {|v| @fields << Solr::Field.new(name => v)}
|
42
42
|
else
|
43
43
|
@fields << Solr::Field.new(name => value)
|
data/lib/solr/importer/mapper.rb
CHANGED
@@ -25,7 +25,7 @@ class Solr::Importer::Mapper
|
|
25
25
|
when String
|
26
26
|
field_mapping
|
27
27
|
when Proc
|
28
|
-
field_mapping.call(orig_data)
|
28
|
+
field_mapping.call(orig_data) # TODO pass in more context, like self or a function for field_data, etc
|
29
29
|
when Symbol
|
30
30
|
field_data(orig_data, @options[:stringify_symbols] ? field_mapping.to_s : field_mapping)
|
31
31
|
when Enumerable
|
data/lib/solr/request/dismax.rb
CHANGED
data/lib/solr/response/ping.rb
CHANGED
data/lib/solr/response/ruby.rb
CHANGED
@@ -14,7 +14,7 @@ class Solr::Response::Ruby < Solr::Response::Base
|
|
14
14
|
attr_reader :data
|
15
15
|
|
16
16
|
def initialize(ruby_code)
|
17
|
-
super
|
17
|
+
super
|
18
18
|
begin
|
19
19
|
#TODO: what about pulling up data/header/response to ResponseBase,
|
20
20
|
# or maybe a new middle class like SelectResponseBase since
|
data/lib/solr/response/xml.rb
CHANGED
data/lib/solr/util.rb
CHANGED
@@ -22,13 +22,7 @@ class Solr::Util
|
|
22
22
|
|
23
23
|
# paired_array_to_hash([key1,value1,key2,value2]) => {key1 => value1, key2, value2}
|
24
24
|
def self.paired_array_to_hash(a)
|
25
|
-
|
26
|
-
|
27
|
-
paired_array_each(a) do |key,value|
|
28
|
-
h[key] = value
|
29
|
-
end
|
30
|
-
|
31
|
-
h
|
25
|
+
Hash[*a]
|
32
26
|
end
|
33
27
|
|
34
28
|
end
|
data/test/unit/document_test.rb
CHANGED
@@ -62,4 +62,8 @@ class DocumentTest < Test::Unit::TestCase
|
|
62
62
|
assert_match(/<doc boost=['"]300.28['"]>[\s]*<field name=['"]name['"]>McGrump<\/field>[\s]*<\/doc>/, doc.to_xml.to_s)
|
63
63
|
end
|
64
64
|
|
65
|
+
def test_string_values
|
66
|
+
doc = Solr::Document.new :name => "multi\nline"
|
67
|
+
assert_match(/<doc>[\s]*<field name=['"]name['"]>multi\nline<\/field>[\s]*<\/doc>/, doc.to_xml.to_s)
|
68
|
+
end
|
65
69
|
end
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.4
|
3
3
|
specification_version: 1
|
4
4
|
name: solr-ruby
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.0.4
|
7
|
+
date: 2007-08-16 00:00:00 -04:00
|
8
8
|
summary: Ruby library for working with Apache Solr
|
9
9
|
require_paths:
|
10
10
|
- lib
|