delsolr 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +13 -3
- data/lib/delsolr/query_builder.rb +3 -2
- data/lib/delsolr.rb +0 -1
- data/test/test_client.rb +1 -1
- metadata +20 -35
- data/History.txt +0 -5
- data/Manifest.txt +0 -13
- data/Rakefile +0 -4
- data/lib/delsolr/version.rb +0 -9
- data/test/test_document.rb +0 -29
data/README.txt
CHANGED
@@ -7,9 +7,9 @@ http://delsolr.rubyforge.org
|
|
7
7
|
DelSolr is a light weight ruby wrapper for solr. It's intention is to expose the full power of solr queries
|
8
8
|
while keeping the interface as ruby-esque as possible.
|
9
9
|
|
10
|
-
==
|
10
|
+
== PROBLEMS:
|
11
11
|
|
12
|
-
*
|
12
|
+
* Not threadsafe yet
|
13
13
|
|
14
14
|
== SYNOPSIS:
|
15
15
|
|
@@ -38,6 +38,17 @@ Example:
|
|
38
38
|
# output a query facet
|
39
39
|
puts "Cheap Apple stuff: #{rsp.facet_query_count_by_name('cheap_apple')}"
|
40
40
|
|
41
|
+
# adding things
|
42
|
+
doc = DelSolr::Document.new
|
43
|
+
doc.add_field('id', 'ABC-123')
|
44
|
+
doc.add_field('name', '8 Gig Shuffle')
|
45
|
+
doc.add_field('description', 'A crazy-tiny MP3 player')
|
46
|
+
c.update!(doc) # posts new document to solr
|
47
|
+
c.commit! # posts a commit to solr
|
48
|
+
|
49
|
+
rsp = c.query('dismax', :query => 'shuffle mp3 player')
|
50
|
+
puts rsp.ids[0]
|
51
|
+
|
41
52
|
|
42
53
|
== REQUIREMENTS:
|
43
54
|
|
@@ -49,7 +60,6 @@ sudo gem install delsolr
|
|
49
60
|
|
50
61
|
== TODO:
|
51
62
|
|
52
|
-
* finish unit tests (use mocha to stub out Net::HTTP)
|
53
63
|
* implement delete_by_query
|
54
64
|
* make thread safe
|
55
65
|
* it would be nice to be able to have things like commit/optimize be ran in threads on timers periodically
|
@@ -71,6 +71,7 @@ module DelSolr
|
|
71
71
|
|
72
72
|
filters = opts.delete(:filters)
|
73
73
|
params += build_filters(:fq, filters)
|
74
|
+
params += build_filters(:bq, opts.delete(:bq))
|
74
75
|
|
75
76
|
facets = opts.delete(:facets)
|
76
77
|
if facets
|
@@ -127,7 +128,7 @@ module DelSolr
|
|
127
128
|
query_string_array << "#{k}:#{val}"
|
128
129
|
end
|
129
130
|
elsif v.is_a?(Range)
|
130
|
-
query_string_array << "#{k}:[#{v.
|
131
|
+
query_string_array << "#{k}:[#{v.begin} TO #{v.end}]"
|
131
132
|
else
|
132
133
|
query_string_array << "#{k}:#{v}"
|
133
134
|
end
|
@@ -154,7 +155,7 @@ module DelSolr
|
|
154
155
|
params << {key => "#{k}:#{val}"}
|
155
156
|
end
|
156
157
|
elsif v.is_a?(Range)
|
157
|
-
params << {key => "#{k}:[#{v.
|
158
|
+
params << {key => "#{k}:[#{v.begin} TO #{v.end}]"}
|
158
159
|
else
|
159
160
|
params << {key => "#{k}:#{v}"}
|
160
161
|
end
|
data/lib/delsolr.rb
CHANGED
@@ -11,7 +11,6 @@ require 'net/http'
|
|
11
11
|
|
12
12
|
require 'digest/md5'
|
13
13
|
|
14
|
-
require File.join(File.dirname(__FILE__), 'delsolr', 'version')
|
15
14
|
require File.join(File.dirname(__FILE__), 'delsolr', 'response')
|
16
15
|
require File.join(File.dirname(__FILE__), 'delsolr', 'configuration')
|
17
16
|
require File.join(File.dirname(__FILE__), 'delsolr', 'query_builder')
|
data/test/test_client.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delsolr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben VandenBos
|
@@ -9,57 +9,43 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-11-02 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
16
|
+
name: mocha
|
17
17
|
type: :development
|
18
18
|
version_requirement:
|
19
19
|
version_requirements: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
23
|
+
version: 0.9.0
|
24
24
|
version:
|
25
|
-
description:
|
25
|
+
description: Ruby wrapper for Lucene Solr
|
26
26
|
email:
|
27
|
-
- bvandenbos@gmail.com
|
28
27
|
executables: []
|
29
28
|
|
30
29
|
extensions: []
|
31
30
|
|
32
|
-
extra_rdoc_files:
|
33
|
-
|
34
|
-
- License.txt
|
35
|
-
- Manifest.txt
|
36
|
-
- README.txt
|
31
|
+
extra_rdoc_files: []
|
32
|
+
|
37
33
|
files:
|
38
|
-
- History.txt
|
39
34
|
- License.txt
|
40
|
-
- Manifest.txt
|
41
35
|
- README.txt
|
42
|
-
- Rakefile
|
43
36
|
- lib/delsolr.rb
|
44
37
|
- lib/delsolr/configuration.rb
|
45
38
|
- lib/delsolr/extensions.rb
|
46
39
|
- lib/delsolr/query_builder.rb
|
47
40
|
- lib/delsolr/response.rb
|
48
41
|
- lib/delsolr/document.rb
|
49
|
-
- lib/delsolr/version.rb
|
50
42
|
has_rdoc: true
|
51
|
-
homepage: http://delsolr
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
You can also delete it if you don't want it.
|
58
|
-
|
59
|
-
|
60
|
-
rdoc_options:
|
61
|
-
- --main
|
62
|
-
- README.txt
|
43
|
+
homepage: http://github.com/avvo/delsolr
|
44
|
+
licenses: []
|
45
|
+
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options: []
|
48
|
+
|
63
49
|
require_paths:
|
64
50
|
- lib
|
65
51
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -76,14 +62,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
62
|
version:
|
77
63
|
requirements: []
|
78
64
|
|
79
|
-
rubyforge_project:
|
80
|
-
rubygems_version: 1.
|
65
|
+
rubyforge_project:
|
66
|
+
rubygems_version: 1.3.5
|
81
67
|
signing_key:
|
82
|
-
specification_version:
|
83
|
-
summary:
|
68
|
+
specification_version: 3
|
69
|
+
summary: DelSolr is a light weight ruby wrapper for solr. It's intention is to expose the full power of solr queries while keeping the interface as ruby-esque as possible.
|
84
70
|
test_files:
|
85
|
-
- test/test_response.rb
|
86
|
-
- test/test_query_builder.rb
|
87
|
-
- test/test_helper.rb
|
88
|
-
- test/test_document.rb
|
89
71
|
- test/test_client.rb
|
72
|
+
- test/test_helper.rb
|
73
|
+
- test/test_query_builder.rb
|
74
|
+
- test/test_response.rb
|
data/History.txt
DELETED
data/Manifest.txt
DELETED
data/Rakefile
DELETED
data/lib/delsolr/version.rb
DELETED
data/test/test_document.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/test_helper'
|
2
|
-
|
3
|
-
class DocumentTest < Test::Unit::TestCase
|
4
|
-
|
5
|
-
include Test::Unit::Assertions
|
6
|
-
|
7
|
-
def test_create
|
8
|
-
d = DelSolr::Document.new
|
9
|
-
assert(d)
|
10
|
-
|
11
|
-
d.add_field('person_name', 'John Smith')
|
12
|
-
|
13
|
-
buf = "<doc>\n<field name=\"person_name\">John Smith</field>\n</doc>"
|
14
|
-
|
15
|
-
assert_equal(buf, d.xml)
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_cdata
|
19
|
-
d = DelSolr::Document.new
|
20
|
-
assert(d)
|
21
|
-
|
22
|
-
d.add_field('person_name', 'John Smith', :cdata => true)
|
23
|
-
|
24
|
-
buf = "<doc>\n<field name=\"person_name\"><![CDATA[John Smith]]></field>\n</doc>"
|
25
|
-
|
26
|
-
assert_equal(buf, d.xml)
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|