mwmitchell-rsolr-ext 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/lib/rsolr-ext.rb CHANGED
@@ -15,7 +15,7 @@ module RSolr
15
15
 
16
16
  module Ext
17
17
 
18
- VERSION = '0.2.1'
18
+ VERSION = '0.4.1'
19
19
 
20
20
  autoload :Request, 'rsolr-ext/request.rb'
21
21
  autoload :Response, 'rsolr-ext/response.rb'
data/rsolr-ext.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "rsolr-ext"
3
+ s.version = "0.4.1"
4
+ s.date = "2009-03-15"
5
+ s.summary = "An extension lib for RSolr"
6
+ s.email = "goodieboy@gmail.com"
7
+ s.homepage = "http://github.com/mwmitchell/rsolr_ext"
8
+ s.description = "An extension lib for RSolr"
9
+ s.has_rdoc = true
10
+ s.authors = ["Matt Mitchell"]
11
+ s.files = [
12
+ "lib/rsolr-ext.rb",
13
+ "lib/rsolr-ext/params.rb",
14
+ "lib/rsolr-ext/request.rb",
15
+ "lib/rsolr-ext/request/standard.rb",
16
+ "lib/rsolr-ext/request/dismax.rb",
17
+ "lib/rsolr-ext/response.rb",
18
+ "lib/rsolr-ext/response/base.rb",
19
+ "lib/rsolr-ext/response/luke.rb",
20
+ "lib/rsolr-ext/response/select.rb",
21
+ "lib/rsolr-ext/response/update.rb",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "rsolr-ext.gemspec"
25
+ ]
26
+ s.test_files = ['test/request_test.rb', 'test/response_test.rb', 'test/test_unit_test_case.rb', 'test/helper.rb']
27
+ s.extra_rdoc_files = %w(LICENSE README.rdoc)
28
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,21 @@
1
+ def mock_query_response
2
+ %({'responseHeader'=>{
3
+ 'status'=>0,'QTime'=>43,'params'=>{
4
+ 'q'=>'*:*','wt'=>'ruby','echoParams'=>'EXPLICIT'
5
+ }
6
+ },
7
+ 'response'=>{
8
+ 'numFound'=>26,'start'=>0,'docs'=>[
9
+ {'id'=>'SP2514N','inStock'=>true,'manu'=>'Samsung Electronics Co. Ltd.','name'=>'Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133','popularity'=>6,'price'=>92.0,'sku'=>'SP2514N','timestamp'=>'2008-11-21T17:21:55.601Z','cat'=>['electronics','hard drive'],'spell'=>['Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133'],'features'=>['7200RPM, 8MB cache, IDE Ultra ATA-133','NoiseGuard, SilentSeek technology, Fluid Dynamic Bearing (FDB) motor']},
10
+ {'id'=>'6H500F0','inStock'=>true,'manu'=>'Maxtor Corp.','name'=>'Maxtor DiamondMax 11 - hard drive - 500 GB - SATA-300','popularity'=>6,'price'=>350.0,'sku'=>'6H500F0','timestamp'=>'2008-11-21T17:21:55.617Z','cat'=>['electronics','hard drive'],'spell'=>['Maxtor DiamondMax 11 - hard drive - 500 GB - SATA-300'],'features'=>['SATA 3.0Gb/s, NCQ','8.5ms seek','16MB cache']},
11
+ {'id'=>'F8V7067-APL-KIT','inStock'=>false,'manu'=>'Belkin','name'=>'Belkin Mobile Power Cord for iPod w/ Dock','popularity'=>1,'price'=>19.95,'sku'=>'F8V7067-APL-KIT','timestamp'=>'2008-11-21T17:21:55.652Z','weight'=>4.0,'cat'=>['electronics','connector'],'spell'=>['Belkin Mobile Power Cord for iPod w/ Dock'],'features'=>['car power adapter, white']},
12
+ {'id'=>'IW-02','inStock'=>false,'manu'=>'Belkin','name'=>'iPod & iPod Mini USB 2.0 Cable','popularity'=>1,'price'=>11.5,'sku'=>'IW-02','timestamp'=>'2008-11-21T17:21:55.657Z','weight'=>2.0,'cat'=>['electronics','connector'],'spell'=>['iPod & iPod Mini USB 2.0 Cable'],'features'=>['car power adapter for iPod, white']},
13
+ {'id'=>'MA147LL/A','inStock'=>true,'includes'=>'earbud headphones, USB cable','manu'=>'Apple Computer Inc.','name'=>'Apple 60 GB iPod with Video Playback Black','popularity'=>10,'price'=>399.0,'sku'=>'MA147LL/A','timestamp'=>'2008-11-21T17:21:55.681Z','weight'=>5.5,'cat'=>['electronics','music'],'spell'=>['Apple 60 GB iPod with Video Playback Black'],'features'=>['iTunes, Podcasts, Audiobooks','Stores up to 15,000 songs, 25,000 photos, or 150 hours of video','2.5-inch, 320x240 color TFT LCD display with LED backlight','Up to 20 hours of battery life','Plays AAC, MP3, WAV, AIFF, Audible, Apple Lossless, H.264 video','Notes, Calendar, Phone book, Hold button, Date display, Photo wallet, Built-in games, JPEG photo playback, Upgradeable firmware, USB 2.0 compatibility, Playback speed control, Rechargeable capability, Battery level indication']},
14
+ {'id'=>'TWINX2048-3200PRO','inStock'=>true,'manu'=>'Corsair Microsystems Inc.','name'=>'CORSAIR XMS 2GB (2 x 1GB) 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) Dual Channel Kit System Memory - Retail','popularity'=>5,'price'=>185.0,'sku'=>'TWINX2048-3200PRO','timestamp'=>'2008-11-21T17:21:55.706Z','cat'=>['electronics','memory'],'spell'=>['CORSAIR XMS 2GB (2 x 1GB) 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) Dual Channel Kit System Memory - Retail'],'features'=>['CAS latency 2, 2-3-3-6 timing, 2.75v, unbuffered, heat-spreader']},
15
+ {'id'=>'VS1GB400C3','inStock'=>true,'manu'=>'Corsair Microsystems Inc.','name'=>'CORSAIR ValueSelect 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - Retail','popularity'=>7,'price'=>74.99,'sku'=>'VS1GB400C3','timestamp'=>'2008-11-21T17:21:55.71Z','cat'=>['electronics','memory'],'spell'=>['CORSAIR ValueSelect 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - Retail']},
16
+ {'id'=>'VDBDB1A16','inStock'=>true,'manu'=>'A-DATA Technology Inc.','name'=>'A-DATA V-Series 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - OEM','popularity'=>5,'sku'=>'VDBDB1A16','timestamp'=>'2008-11-21T17:21:55.712Z','cat'=>['electronics','memory'],'spell'=>['A-DATA V-Series 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - OEM'],'features'=>['CAS latency 3, 2.7v']},
17
+ {'id'=>'3007WFP','inStock'=>true,'includes'=>'USB cable','manu'=>'Dell, Inc.','name'=>'Dell Widescreen UltraSharp 3007WFP','popularity'=>6,'price'=>2199.0,'sku'=>'3007WFP','timestamp'=>'2008-11-21T17:21:55.724Z','weight'=>401.6,'cat'=>['electronics','monitor'],'spell'=>['Dell Widescreen UltraSharp 3007WFP'],'features'=>['30" TFT active matrix LCD, 2560 x 1600, .25mm dot pitch, 700:1 contrast']},
18
+ {'id'=>'VA902B','inStock'=>true,'manu'=>'ViewSonic Corp.','name'=>'ViewSonic VA902B - flat panel display - TFT - 19"','popularity'=>6,'price'=>279.95,'sku'=>'VA902B','timestamp'=>'2008-11-21T17:21:55.734Z','weight'=>190.4,'cat'=>['electronics','monitor'],'spell'=>['ViewSonic VA902B - flat panel display - TFT - 19"'],'features'=>['19" TFT active matrix LCD, 8ms response time, 1280 x 1024 native resolution']}]
19
+ }
20
+ })
21
+ end
@@ -0,0 +1,22 @@
1
+ require 'test_unit_test_case'
2
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'rsolr-ext')
3
+
4
+ class RSolrExtRequestTest < Test::Unit::TestCase
5
+
6
+ test 'standard request' do
7
+ std = RSolr::Ext::Request::Standard.new
8
+ solr_params = std.map(
9
+ :page=>2,
10
+ :per_page=>10,
11
+ :phrases=>{:name=>'This is a phrase'},
12
+ :filters=>['test', {:price=>(1..10)}],
13
+ :phrase_filters=>{:manu=>['Apple']},
14
+ :q=>'ipod'
15
+ )
16
+ assert_equal "test price:[1 TO 10] manu:\"Apple\"", solr_params[:fq]
17
+ assert_equal 10, solr_params[:start]
18
+ assert_equal 10, solr_params[:rows]
19
+ assert_equal "ipod name:\"This is a phrase\"", solr_params[:q]
20
+ end
21
+
22
+ end
@@ -0,0 +1,13 @@
1
+ require 'test_unit_test_case'
2
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'rsolr-ext')
3
+ require 'helper'
4
+
5
+ class RSolrExtResponseTest < Test::Unit::TestCase
6
+
7
+ test 'base response module' do
8
+ raw_response = eval(mock_query_response)
9
+ r = RSolr::Ext::Response::Base.create(raw_response)
10
+ assert r.ok?
11
+ end
12
+
13
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mwmitchell-rsolr-ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Mitchell
@@ -35,7 +35,7 @@ files:
35
35
  - lib/rsolr-ext/response/update.rb
36
36
  - LICENSE
37
37
  - README.rdoc
38
- - rsolr_ext.gemspec
38
+ - rsolr-ext.gemspec
39
39
  has_rdoc: true
40
40
  homepage: http://github.com/mwmitchell/rsolr_ext
41
41
  post_install_message:
@@ -63,6 +63,7 @@ signing_key:
63
63
  specification_version: 2
64
64
  summary: An extension lib for RSolr
65
65
  test_files:
66
- - test/rsolr_ext_standard_test.rb
67
- - test/rsolr_ext_test.rb
66
+ - test/request_test.rb
67
+ - test/response_test.rb
68
68
  - test/test_unit_test_case.rb
69
+ - test/helper.rb