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 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
- == FEATURES/PROBLEMS:
10
+ == PROBLEMS:
11
11
 
12
- * Only supports querying (GET), no indexing (POST) support yet
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.min} TO #{v.max}]"
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.min} TO #{v.max}]"}
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
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/test_helper'
2
2
  require 'rubygems'
3
- gem 'mocha', '=0.9.0'
3
+ gem 'mocha', '>=0.9.0'
4
4
  require 'mocha'
5
5
 
6
6
  class ClientTest < Test::Unit::TestCase
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.2
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: 2008-10-22 00:00:00 -07:00
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: hoe
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: 1.7.0
23
+ version: 0.9.0
24
24
  version:
25
- description: Wrapper for querying Lucene Solr
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
- - History.txt
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.rubyforge.org
52
- post_install_message: |+
53
-
54
- For more information on delsolr, see http://delsolr.rubyforge.org
55
-
56
- NOTE: Change this information in PostInstall.txt
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: delsolr
80
- rubygems_version: 1.2.0
65
+ rubyforge_project:
66
+ rubygems_version: 1.3.5
81
67
  signing_key:
82
- specification_version: 2
83
- summary: Wrapper for querying Lucene Solr
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
@@ -1,5 +0,0 @@
1
- == 0.0.1 2008-09-08
2
-
3
- * 1 major enhancement:
4
- * Initial release
5
- * No support for POST
data/Manifest.txt DELETED
@@ -1,13 +0,0 @@
1
- History.txt
2
- License.txt
3
- Manifest.txt
4
- README.txt
5
- Rakefile
6
- lib/delsolr.rb
7
- lib/delsolr/configuration.rb
8
- lib/delsolr/extensions.rb
9
- lib/delsolr/query_builder.rb
10
- lib/delsolr/response.rb
11
- lib/delsolr/document.rb
12
- lib/delsolr/version.rb
13
-
data/Rakefile DELETED
@@ -1,4 +0,0 @@
1
- require 'config/requirements'
2
- require 'config/hoe' # setup Hoe + all gem configuration
3
-
4
- Dir['tasks/**/*.rake'].each { |rake| load rake }
@@ -1,9 +0,0 @@
1
- module DelSolr
2
- module VERSION #:nodoc:
3
- MAJOR = 0
4
- MINOR = 0
5
- TINY = 2
6
-
7
- STRING = [MAJOR, MINOR, TINY].join('.')
8
- end
9
- end
@@ -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