Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Apache Solr JavaBin format (binary format) implementation for Ruby
Ruby C
tree: a22f129bfc

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
ext/java_bin/ext
fixtures
lib
test
.document
.gitignore
CHANGELOG
LICENSE
README.rdoc
Rakefile
VERSION
how_to_release.txt
java_bin.gemspec

README.rdoc

java_bin

This is an Apache Solr JavaBin format (binary format) implementation for Ruby.

Features

  • fast parse(2.5 - 5 times faster than ruby eval), and less network traffic.

MRI 1.8.7
 [data2]
 ruby eval parse. 5000 times. elapsed time 6.664981
 javabin parse.   5000 times. elapsed time 1.472825
 4.52530409247534 times

REE 1.8.7
 [data2]
 ruby eval parse. 5000 times. elapsed time 4.844482
 javabin parse.   5000 times. elapsed time 1.059044
 4.57439162112245 times

YARV 1.9.2 pre1
 [data2]
 ruby eval parse. 5000 times. elapsed time 6.659331328
 javabin parse.   5000 times. elapsed time 1.261828473
 5.277525012704322 times
  • rsolr/solr-ruby support.

  • pure and c extension code.

  • ruby 1.8/1.9 support.

  • solr 1.4/3.1 support.

Requirements

  • Ruby1.8.7 or later (include 1.9.x)

  • (recommended) C compiler (gcc or vc++): you can also use java_bin without c extension, but 'pure' is 30 times slower than 'ext'.

  • JavaBin has been tested with MRI 1.8.7, REE 1.8.7, YARV 1.9.2 pre1 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

Install

(Linux)
gem sources -a http://gemcutter.org
gem install java_bin

(Windows)
fix (path to)\ruby\lib\ruby\1.8\i386-mswin32\config.h
  #if _MSC_VER != 1200
    ↓
  #if _MSC_VER < 1200

start => visual studio c++ 200x xxxx edition => visual studio tools => visual studio 200x command prompt
gem sources -a http://gemcutter.org
gem install java_bin
  or
cd (path to)\ext\java_bin\ext
ruby extconf.rb
nmake

Simple Usage

require 'rubygems'
require 'java_bin'

@parser = JavaBin.parser.new
result = @parser.parse( javabin format string )

With RSolr/Solr-Ruby

  • By RSolr/Solr-Ruby support, a parser automatically uses javabin format instead of ruby format.

require 'rubygems'
require 'rsolr'
require 'java_bin'

solr = RSolr.connect
solr.select :q => '*:*'

TODO

  • more parse speed

  • license

  • shared string over parsing

  • builder(writer)

  • JRuby support

References

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don't break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Author

Toshinori Kajihara <kennyj@gmail.com>

Copyright

Copyright © 2010, 2011 kennyj. See LICENSE for details.

Something went wrong with that request. Please try again.