java_bin 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +5 -0
- data/CHANGELOG +5 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +31 -0
- data/README.rdoc +3 -5
- data/Rakefile +10 -2
- data/VERSION +1 -1
- data/how_to_release.txt +10 -0
- data/java_bin.gemspec +21 -8
- data/lib/java_bin/version.rb +1 -1
- data/lib/rsolr_support.rb +15 -8
- data/test/helper.rb +7 -0
- data/test/test_java_bin_parser.rb +0 -3
- data/test/test_rsolr_support.rb +30 -0
- metadata +56 -6
data/.travis.yml
ADDED
data/CHANGELOG
CHANGED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
builder (3.0.0)
|
5
|
+
git (1.2.5)
|
6
|
+
jeweler (1.8.4)
|
7
|
+
bundler (~> 1.0)
|
8
|
+
git (>= 1.2.5)
|
9
|
+
rake
|
10
|
+
rdoc
|
11
|
+
json (1.7.5)
|
12
|
+
metaclass (0.0.1)
|
13
|
+
mocha (0.12.3)
|
14
|
+
metaclass (~> 0.0.1)
|
15
|
+
rake (0.9.2.2)
|
16
|
+
rake-compiler (0.8.1)
|
17
|
+
rake
|
18
|
+
rdoc (3.12)
|
19
|
+
json (~> 1.4)
|
20
|
+
rsolr (1.0.8)
|
21
|
+
builder (>= 2.1.2)
|
22
|
+
|
23
|
+
PLATFORMS
|
24
|
+
ruby
|
25
|
+
|
26
|
+
DEPENDENCIES
|
27
|
+
jeweler
|
28
|
+
json
|
29
|
+
mocha
|
30
|
+
rake-compiler
|
31
|
+
rsolr
|
data/README.rdoc
CHANGED
@@ -32,7 +32,7 @@ This is an Apache Solr JavaBin format (binary format) implementation for Ruby.
|
|
32
32
|
|
33
33
|
* Ruby1.8.7 or later (include 1.9.x)
|
34
34
|
* (recommended) C compiler (gcc or vc++): you can also use java_bin without c extension, but 'pure' is 30 times slower than 'ext'.
|
35
|
-
* JavaBin has been tested with MRI 1.8.7, REE 1.8.7, YARV 1.9.2
|
35
|
+
* JavaBin has been tested with MRI 1.8.7, REE 1.8.7, YARV 1.9.2, YARV 1.9.3 on Ubuntu Linux 9.10 (32bit) and MRI 1.8.6, YARV 1.9.1 on Windows Vista (32bit), and Apache Solr 1.4, 3.1
|
36
36
|
|
37
37
|
== Install
|
38
38
|
|
@@ -75,12 +75,10 @@ This is an Apache Solr JavaBin format (binary format) implementation for Ruby.
|
|
75
75
|
|
76
76
|
== TODO
|
77
77
|
|
78
|
-
* Solr 3.1 support
|
79
|
-
* max os x supoort
|
80
78
|
* more parse speed
|
81
79
|
* license
|
82
80
|
* shared string over parsing
|
83
|
-
* builder(writer)
|
81
|
+
* builder(writer)
|
84
82
|
* JRuby support
|
85
83
|
|
86
84
|
== References
|
@@ -106,4 +104,4 @@ Toshinori Kajihara <mailto:kennyj@gmail.com>
|
|
106
104
|
|
107
105
|
== Copyright
|
108
106
|
|
109
|
-
Copyright (c) 2010 kennyj. See LICENSE for details.
|
107
|
+
Copyright (c) 2010 - 2012 kennyj. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
|
+
require 'rake/extensiontask'
|
4
|
+
|
5
|
+
Rake::ExtensionTask.new do |ext|
|
6
|
+
ext.name = 'parser' # indicate the name of the extension.
|
7
|
+
ext.ext_dir = 'ext/java_bin/ext' # search for 'hello_world' inside it.
|
8
|
+
ext.lib_dir = 'lib/java_bin/ext' # put binaries into this folder.
|
9
|
+
ext.tmp_dir = 'tmp' # temporary folder used during compilation.
|
10
|
+
end
|
3
11
|
|
4
12
|
begin
|
5
13
|
require 'jeweler'
|
@@ -38,11 +46,11 @@ rescue LoadError
|
|
38
46
|
end
|
39
47
|
end
|
40
48
|
|
41
|
-
task :test => :
|
49
|
+
task :test => :compile
|
42
50
|
|
43
51
|
task :default => :test
|
44
52
|
|
45
|
-
require '
|
53
|
+
require 'rdoc/task'
|
46
54
|
Rake::RDocTask.new do |rdoc|
|
47
55
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
56
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/how_to_release.txt
CHANGED
data/java_bin.gemspec
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.4.
|
7
|
+
s.name = "java_bin"
|
8
|
+
s.version = "0.4.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["kennyj"]
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = "2012-09-03"
|
13
|
+
s.description = "Apache Solr JavaBin format (binary format) implementation for Ruby."
|
14
|
+
s.email = "kennyj@gmail.com"
|
15
15
|
s.extensions = ["ext/java_bin/ext/extconf.rb"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"LICENSE",
|
@@ -19,7 +19,10 @@ Gem::Specification.new do |s|
|
|
19
19
|
]
|
20
20
|
s.files = [
|
21
21
|
".document",
|
22
|
+
".travis.yml",
|
22
23
|
"CHANGELOG",
|
24
|
+
"Gemfile",
|
25
|
+
"Gemfile.lock",
|
23
26
|
"LICENSE",
|
24
27
|
"README.rdoc",
|
25
28
|
"Rakefile",
|
@@ -52,20 +55,30 @@ Gem::Specification.new do |s|
|
|
52
55
|
"lib/solr_ruby_support.rb",
|
53
56
|
"test/helper.rb",
|
54
57
|
"test/test_java_bin_parser.rb",
|
58
|
+
"test/test_rsolr_support.rb",
|
55
59
|
"test/xxx_performance.rb"
|
56
60
|
]
|
57
|
-
s.homepage =
|
61
|
+
s.homepage = "http://github.com/kennyj/java_bin"
|
58
62
|
s.require_paths = ["lib", "ext"]
|
59
|
-
s.rubygems_version =
|
60
|
-
s.summary =
|
63
|
+
s.rubygems_version = "1.8.24"
|
64
|
+
s.summary = "Apache Solr JavaBin format implementation for Ruby."
|
61
65
|
|
62
66
|
if s.respond_to? :specification_version then
|
63
67
|
s.specification_version = 3
|
64
68
|
|
65
69
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
70
|
+
s.add_runtime_dependency(%q<jeweler>, [">= 0"])
|
71
|
+
s.add_runtime_dependency(%q<rake-compiler>, [">= 0"])
|
72
|
+
s.add_runtime_dependency(%q<json>, [">= 0"])
|
66
73
|
else
|
74
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
75
|
+
s.add_dependency(%q<rake-compiler>, [">= 0"])
|
76
|
+
s.add_dependency(%q<json>, [">= 0"])
|
67
77
|
end
|
68
78
|
else
|
79
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
80
|
+
s.add_dependency(%q<rake-compiler>, [">= 0"])
|
81
|
+
s.add_dependency(%q<json>, [">= 0"])
|
69
82
|
end
|
70
83
|
end
|
71
84
|
|
data/lib/java_bin/version.rb
CHANGED
data/lib/rsolr_support.rb
CHANGED
@@ -4,15 +4,22 @@ if defined? RSolr::Client
|
|
4
4
|
|
5
5
|
class RSolr::Client
|
6
6
|
protected
|
7
|
-
|
8
|
-
def
|
9
|
-
params
|
10
|
-
|
7
|
+
|
8
|
+
def send_and_receive_with_java_bin(path, opts={})
|
9
|
+
if opts[:params].nil?
|
10
|
+
opts[:params]={}
|
11
|
+
end
|
12
|
+
opts[:params][:wt] = :javabin
|
13
|
+
|
14
|
+
send_and_receive_without_java_bin(path, opts)
|
11
15
|
end
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
+
|
17
|
+
alias_method :send_and_receive_without_java_bin, :send_and_receive
|
18
|
+
alias_method :send_and_receive, :send_and_receive_with_java_bin
|
19
|
+
|
20
|
+
def adapt_response_with_java_bin(request, response)
|
21
|
+
data = adapt_response_without_java_bin(request, response)
|
22
|
+
data = JavaBin.parser.new.parse(data) if request[:params][:wt] == :javabin
|
16
23
|
data
|
17
24
|
end
|
18
25
|
|
data/test/helper.rb
CHANGED
@@ -1,10 +1,17 @@
|
|
1
1
|
# vim:fileencoding=utf-8
|
2
2
|
require 'rubygems'
|
3
|
+
require 'bundler'
|
3
4
|
require 'test/unit'
|
4
5
|
|
6
|
+
ENV['TZ']='JST-9'
|
5
7
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
6
8
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
9
|
+
|
10
|
+
Bundler.require(:test)
|
11
|
+
|
7
12
|
require 'java_bin'
|
8
13
|
|
9
14
|
class Test::Unit::TestCase
|
15
|
+
READ_UTF8 = (RUBY_VERSION >= '1.9' ? 'rb:utf-8' : 'rb')
|
16
|
+
READ_ASCII = (RUBY_VERSION >= '1.9' ? 'rb:ascii' : 'rb')
|
10
17
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/helper'
|
2
|
+
|
3
|
+
class TestRSolrSupportTest < Test::Unit::TestCase
|
4
|
+
def test_queries_are_performed_with_javabin
|
5
|
+
|
6
|
+
rsolr_connection=mock()
|
7
|
+
rsolr_connection.expects(:execute).
|
8
|
+
with { |rsolr_client, params|
|
9
|
+
assert_equal({:wt => :javabin}, params[:params])
|
10
|
+
true
|
11
|
+
}.
|
12
|
+
returns(:status => 200,
|
13
|
+
:headers => '',
|
14
|
+
:body => open(File.join(File.dirname(__FILE__), '..', 'fixtures', 'javabin2.dat'), READ_ASCII).read)
|
15
|
+
|
16
|
+
RSolr::Connection.expects(:new).returns(rsolr_connection)
|
17
|
+
|
18
|
+
rsolr = RSolr.connect
|
19
|
+
|
20
|
+
assert_equal({"status" => 0,
|
21
|
+
"QTime" => 0,
|
22
|
+
"params" =>
|
23
|
+
{"indent" => "on",
|
24
|
+
"start" => "0",
|
25
|
+
"q" => "*:*\r\n",
|
26
|
+
"wt" => "javabin",
|
27
|
+
"version" => "2.2",
|
28
|
+
"rows" => "100"}}, rsolr.select(:q => 'whatever')['responseHeader'])
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: java_bin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,9 +9,56 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
|
14
|
-
|
12
|
+
date: 2012-09-03 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: jeweler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake-compiler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: json
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
15
62
|
description: Apache Solr JavaBin format (binary format) implementation for Ruby.
|
16
63
|
email: kennyj@gmail.com
|
17
64
|
executables: []
|
@@ -22,7 +69,10 @@ extra_rdoc_files:
|
|
22
69
|
- README.rdoc
|
23
70
|
files:
|
24
71
|
- .document
|
72
|
+
- .travis.yml
|
25
73
|
- CHANGELOG
|
74
|
+
- Gemfile
|
75
|
+
- Gemfile.lock
|
26
76
|
- LICENSE
|
27
77
|
- README.rdoc
|
28
78
|
- Rakefile
|
@@ -55,8 +105,8 @@ files:
|
|
55
105
|
- lib/solr_ruby_support.rb
|
56
106
|
- test/helper.rb
|
57
107
|
- test/test_java_bin_parser.rb
|
108
|
+
- test/test_rsolr_support.rb
|
58
109
|
- test/xxx_performance.rb
|
59
|
-
has_rdoc: true
|
60
110
|
homepage: http://github.com/kennyj/java_bin
|
61
111
|
licenses: []
|
62
112
|
post_install_message:
|
@@ -78,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
128
|
version: '0'
|
79
129
|
requirements: []
|
80
130
|
rubyforge_project:
|
81
|
-
rubygems_version: 1.
|
131
|
+
rubygems_version: 1.8.24
|
82
132
|
signing_key:
|
83
133
|
specification_version: 3
|
84
134
|
summary: Apache Solr JavaBin format implementation for Ruby.
|