simple_solr 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.rdoc
CHANGED
@@ -39,13 +39,13 @@ module SimpleSolr
|
|
39
39
|
|
40
40
|
# Full URI to use for all read operations.
|
41
41
|
def uri
|
42
|
-
"
|
42
|
+
"http://#{hostname}:#{port}#{path}"
|
43
43
|
end
|
44
44
|
|
45
45
|
# Full URI to use for all write operations.
|
46
46
|
# Automatically falls back to the <code>uri</code> when no master defined.
|
47
47
|
def master_uri
|
48
|
-
"
|
48
|
+
"http://#{master_hostname}:#{master_port}#{master_path}"
|
49
49
|
end
|
50
50
|
|
51
51
|
private
|
data/lib/simple_solr/version.rb
CHANGED
@@ -14,7 +14,7 @@ describe SimpleSolr::ActiveRecord do
|
|
14
14
|
let(:document) { SimpleDocument.create! :title => 'Omg Ponies' }
|
15
15
|
|
16
16
|
it "posts to solr" do
|
17
|
-
SimpleDocument.should_receive(:post).with("test.local:8983/solr/update?commit=true", :body => "<add><doc><field name=\"id\">#{document.id}</field><field name=\"title\">Omg Ponies</field></doc></add>")
|
17
|
+
SimpleDocument.should_receive(:post).with("http://test.local:8983/solr/update?commit=true", :body => "<add><doc><field name=\"id\">#{document.id}</field><field name=\"title\">Omg Ponies</field></doc></add>")
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -22,8 +22,8 @@ describe SimpleSolr::ActiveRecord do
|
|
22
22
|
let(:document) { SimpleDocument.create! :title => 'Omg Ponies' }
|
23
23
|
|
24
24
|
it "posts to solr" do
|
25
|
-
SimpleDocument.should_receive(:post).with("test.local:8983/solr/update?commit=true", :body => "<add><doc><field name=\"id\">#{document.id}</field><field name=\"title\">Omg Ponies</field></doc></add>")
|
26
|
-
SimpleDocument.should_receive(:post).with("test.local:8983/solr/update?commit=true", :body => "<delete><id>#{document.id}</id></delete>")
|
25
|
+
SimpleDocument.should_receive(:post).with("http://test.local:8983/solr/update?commit=true", :body => "<add><doc><field name=\"id\">#{document.id}</field><field name=\"title\">Omg Ponies</field></doc></add>")
|
26
|
+
SimpleDocument.should_receive(:post).with("http://test.local:8983/solr/update?commit=true", :body => "<delete><id>#{document.id}</id></delete>")
|
27
27
|
document.destroy
|
28
28
|
end
|
29
29
|
end
|
@@ -45,7 +45,7 @@ describe SimpleSolr::ActiveRecord do
|
|
45
45
|
let(:document) { FullDocument.create :title => "Rainbows" }
|
46
46
|
|
47
47
|
it "posts to solr after save" do
|
48
|
-
FullDocument.should_receive(:post).with("test.local:8983/solr?commit=true", :body => "<add><doc><field name=\"id\">full-document-#{document.id}</field><field name=\"title\">Rainbows</field><field name=\"date_creation\">#{document.created_at}</field><field name=\"shared\">false</field><field name=\"body\"></field></doc></add>")
|
48
|
+
FullDocument.should_receive(:post).with("http://test.local:8983/solr?commit=true", :body => "<add><doc><field name=\"id\">full-document-#{document.id}</field><field name=\"title\">Rainbows</field><field name=\"date_creation\">#{document.created_at}</field><field name=\"shared\">false</field><field name=\"body\"></field></doc></add>")
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -6,12 +6,12 @@ describe SimpleSolr::Configuration do
|
|
6
6
|
its(:hostname) { should eq('test.local')}
|
7
7
|
its(:port) { should eq(8983)}
|
8
8
|
its(:path) { should eq('/solr')}
|
9
|
-
its(:uri) { should eq('test.local:8983/solr')}
|
9
|
+
its(:uri) { should eq('http://test.local:8983/solr')}
|
10
10
|
|
11
11
|
its(:master_hostname) { should eq('test.local')}
|
12
12
|
its(:master_port) { should eq(8983)}
|
13
13
|
its(:master_path) { should eq('/solr')}
|
14
|
-
its(:master_uri) { should eq('test.local:8983/solr')}
|
14
|
+
its(:master_uri) { should eq('http://test.local:8983/solr')}
|
15
15
|
|
16
16
|
context "unconfigured Rails env" do
|
17
17
|
before do
|
@@ -29,12 +29,12 @@ describe SimpleSolr::Configuration do
|
|
29
29
|
its(:hostname) { should eq('localhost')}
|
30
30
|
its(:port) { should eq(8983)}
|
31
31
|
its(:path) { should eq('/solr')}
|
32
|
-
its(:uri) { should eq('localhost:8983/solr')}
|
32
|
+
its(:uri) { should eq('http://localhost:8983/solr')}
|
33
33
|
|
34
34
|
its(:master_hostname) { should eq('localhost')}
|
35
35
|
its(:master_port) { should eq(8983)}
|
36
36
|
its(:master_path) { should eq('/solr')}
|
37
|
-
its(:master_uri) { should eq('localhost:8983/solr')}
|
37
|
+
its(:master_uri) { should eq('http://localhost:8983/solr')}
|
38
38
|
end
|
39
39
|
|
40
40
|
context "master/slave configuration" do
|
@@ -43,13 +43,13 @@ describe SimpleSolr::Configuration do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
its(:hostname) { should eq('slave.local')}
|
46
|
-
its(:port) { should eq(
|
47
|
-
its(:path) { should eq('/
|
48
|
-
its(:uri) { should eq('slave.local:
|
46
|
+
its(:port) { should eq(9000)}
|
47
|
+
its(:path) { should eq('/public')}
|
48
|
+
its(:uri) { should eq('http://slave.local:9000/public')}
|
49
49
|
|
50
50
|
its(:master_hostname) { should eq('master.local')}
|
51
|
-
its(:master_port) { should eq(
|
52
|
-
its(:master_path) { should eq('/
|
53
|
-
its(:master_uri) { should eq('master.local:
|
51
|
+
its(:master_port) { should eq(9000)}
|
52
|
+
its(:master_path) { should eq('/public')}
|
53
|
+
its(:master_uri) { should eq('http://master.local:9000/public')}
|
54
54
|
end
|
55
55
|
end
|