java_bin 0.3.5 → 0.4.0
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/CHANGELOG +5 -0
- data/README.rdoc +2 -0
- data/VERSION +1 -1
- data/ext/java_bin/ext/parser.c +22 -5
- data/ext/java_bin/ext/parser.h +8 -1
- data/fixtures/fixtures_for_solr3.1/javabin_all.dat +0 -0
- data/fixtures/fixtures_for_solr3.1/javabin_software.dat +0 -0
- data/fixtures/fixtures_for_solr3.1/json_all.dat +279 -0
- data/fixtures/fixtures_for_solr3.1/json_software.dat +51 -0
- data/fixtures/fixtures_for_solr3.1/ruby_all.dat +279 -0
- data/fixtures/fixtures_for_solr3.1/ruby_software.dat +51 -0
- data/how_to_release.txt +2 -2
- data/java_bin.gemspec +39 -41
- data/lib/java_bin/pure/parser.rb +25 -20
- data/lib/java_bin/version.rb +1 -1
- data/test/test_java_bin_parser.rb +17 -1
- metadata +29 -44
- data/.gitignore +0 -32
data/CHANGELOG
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
+
0.4.0 (2011/6/21)
|
2
|
+
* solr 3.1 support
|
3
|
+
* RailsInstaller support
|
4
|
+
|
1
5
|
0.3.5 (2010/05/22)
|
2
6
|
* fix issue 3
|
3
7
|
* fix issue 4 (strict aliasing rule problem)
|
8
|
+
* 64 bit support (tested with cent os 5.x)
|
4
9
|
|
5
10
|
0.3.4 (2010/02/06)
|
6
11
|
* remove dependence on glibc byteswap.h
|
data/README.rdoc
CHANGED
@@ -26,6 +26,7 @@ This is an Apache Solr JavaBin format (binary format) implementation for Ruby.
|
|
26
26
|
* rsolr/solr-ruby support.
|
27
27
|
* pure and c extension code.
|
28
28
|
* ruby 1.8/1.9 support.
|
29
|
+
* solr 1.4/3.1 support.
|
29
30
|
|
30
31
|
== Requirements
|
31
32
|
|
@@ -74,6 +75,7 @@ This is an Apache Solr JavaBin format (binary format) implementation for Ruby.
|
|
74
75
|
|
75
76
|
== TODO
|
76
77
|
|
78
|
+
* Solr 3.1 support
|
77
79
|
* max os x supoort
|
78
80
|
* more parse speed
|
79
81
|
* license
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/ext/java_bin/ext/parser.c
CHANGED
@@ -87,7 +87,7 @@ static inline VALUE JavaBinParser_read_small_long(JAVA_BIN_PARSER* ptr) {
|
|
87
87
|
return LL2NUM(result);
|
88
88
|
}
|
89
89
|
|
90
|
-
static
|
90
|
+
static VALUE JavaBinParser_read_string_for_javabin_format_1(JAVA_BIN_PARSER* ptr) {
|
91
91
|
int size, i;
|
92
92
|
int start;
|
93
93
|
unsigned char b;
|
@@ -106,6 +106,15 @@ static inline VALUE JavaBinParser_read_string(JAVA_BIN_PARSER* ptr) {
|
|
106
106
|
return _utf8_string((const char*) &ptr->data[start], ptr->current - start);
|
107
107
|
}
|
108
108
|
|
109
|
+
static VALUE JavaBinParser_read_string_for_javabin_format_2(JAVA_BIN_PARSER* ptr) {
|
110
|
+
int size;
|
111
|
+
int start;
|
112
|
+
size = JavaBinParser_read_size(ptr);
|
113
|
+
start = ptr->current;
|
114
|
+
ptr->current += size;
|
115
|
+
return _utf8_string((const char*) &ptr->data[start], size);
|
116
|
+
}
|
117
|
+
|
109
118
|
static inline VALUE JavaBinParser_read_array(JAVA_BIN_PARSER* ptr) {
|
110
119
|
int size, i;
|
111
120
|
VALUE array;
|
@@ -253,7 +262,7 @@ static VALUE JavaBinParser_read_val(JAVA_BIN_PARSER* ptr) {
|
|
253
262
|
ptr->tag_byte = _getbyte(ptr);
|
254
263
|
switch (ptr->tag_byte >> 5) { /* unsignedなので論理シフト */
|
255
264
|
case SHIFTED_STR:
|
256
|
-
return
|
265
|
+
return ptr->read_string(ptr);
|
257
266
|
case SHIFTED_ARR:
|
258
267
|
return JavaBinParser_read_array(ptr);
|
259
268
|
case SHIFTED_EXTERN_STRING:
|
@@ -333,11 +342,19 @@ static VALUE rb_cParser_parse(VALUE self, VALUE data) {
|
|
333
342
|
ptr->data_len = dataLen;
|
334
343
|
|
335
344
|
/* version check */
|
336
|
-
if (ptr->data[0]
|
337
|
-
rb_raise(rb_eRuntimeError, "rb_cParser_parse - not supported version");
|
345
|
+
if (!(ptr->data[0] == 0x01 || ptr->data[0] == 0x02)) {
|
346
|
+
rb_raise(rb_eRuntimeError, "rb_cParser_parse - not supported version [%d]", ptr->data[0]);
|
347
|
+
}
|
348
|
+
|
349
|
+
ptr->version = ptr->data[0];
|
350
|
+
/* 文字列読込用の関数ポインタを設定する */
|
351
|
+
if (ptr->version == 0x01) {
|
352
|
+
ptr->read_string = (void*) JavaBinParser_read_string_for_javabin_format_1;
|
353
|
+
} else if (ptr->version == 0x02) {
|
354
|
+
ptr->read_string = (void*) JavaBinParser_read_string_for_javabin_format_2;
|
338
355
|
}
|
339
356
|
|
340
|
-
ptr->current = 1; /*
|
357
|
+
ptr->current = 1; /* skip format version */
|
341
358
|
ptr->tag_byte = 0;
|
342
359
|
|
343
360
|
/*
|
data/ext/java_bin/ext/parser.h
CHANGED
@@ -52,6 +52,11 @@
|
|
52
52
|
#define SHIFTED_SINT (SINT >> 5)
|
53
53
|
#define SHIFTED_SLONG (SLONG >> 5)
|
54
54
|
|
55
|
+
/*
|
56
|
+
* 文字列読み込み用関数の関数ポインタ
|
57
|
+
*/
|
58
|
+
typedef VALUE (*PTR_READ_STRING)(void*);
|
59
|
+
|
55
60
|
/*
|
56
61
|
* 読込処理データ保持構造体
|
57
62
|
*/
|
@@ -59,7 +64,9 @@ typedef struct java_bin_parser {
|
|
59
64
|
unsigned char* data;
|
60
65
|
int data_len;
|
61
66
|
int current;
|
67
|
+
int version;
|
62
68
|
unsigned char tag_byte;
|
69
|
+
PTR_READ_STRING read_string;
|
63
70
|
|
64
71
|
/* 外部文字列用 */
|
65
72
|
VALUE* cache;
|
@@ -83,7 +90,7 @@ typedef struct java_bin_parser {
|
|
83
90
|
}
|
84
91
|
|
85
92
|
#ifndef WORDS_BIGENDIAN
|
86
|
-
#
|
93
|
+
#if defined _WIN32 && !defined __MINGW32__
|
87
94
|
#define _swap_16(o) _byteswap_ushort(o)
|
88
95
|
#define _swap_32(o) _byteswap_ulong(o)
|
89
96
|
#define _swap_64(o) _byteswap_uint64(o)
|
Binary file
|
Binary file
|
@@ -0,0 +1,279 @@
|
|
1
|
+
{
|
2
|
+
"responseHeader":{
|
3
|
+
"status":0,
|
4
|
+
"QTime":1,
|
5
|
+
"params":{
|
6
|
+
"explainOther":"",
|
7
|
+
"fl":"*,score",
|
8
|
+
"indent":"on",
|
9
|
+
"start":"0",
|
10
|
+
"q":"*:*",
|
11
|
+
"hl.fl":"",
|
12
|
+
"qt":"",
|
13
|
+
"wt":"json",
|
14
|
+
"fq":"",
|
15
|
+
"version":"2.2",
|
16
|
+
"rows":"100"}},
|
17
|
+
"response":{"numFound":17,"start":0,"maxScore":1.0,"docs":[
|
18
|
+
{
|
19
|
+
"id":"GB18030TEST",
|
20
|
+
"name":"Test with some GB18030 encoded characters",
|
21
|
+
"price":0.0,
|
22
|
+
"inStock":true,
|
23
|
+
"features":[
|
24
|
+
"No accents here",
|
25
|
+
"这是一个功能",
|
26
|
+
"This is a feature (translated)",
|
27
|
+
"这份文件是很有光泽",
|
28
|
+
"This document is very shiny (translated)"],
|
29
|
+
"score":1.0},
|
30
|
+
{
|
31
|
+
"id":"SP2514N",
|
32
|
+
"name":"Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133",
|
33
|
+
"manu":"Samsung Electronics Co. Ltd.",
|
34
|
+
"price":92.0,
|
35
|
+
"popularity":6,
|
36
|
+
"inStock":true,
|
37
|
+
"manufacturedate_dt":"2006-02-13T15:26:37Z",
|
38
|
+
"store":"35.0752,-97.032",
|
39
|
+
"cat":["electronics","hard drive"],
|
40
|
+
"features":[
|
41
|
+
"7200RPM, 8MB cache, IDE Ultra ATA-133",
|
42
|
+
"NoiseGuard, SilentSeek technology, Fluid Dynamic Bearing (FDB) motor"],
|
43
|
+
"score":1.0},
|
44
|
+
{
|
45
|
+
"id":"6H500F0",
|
46
|
+
"name":"Maxtor DiamondMax 11 - hard drive - 500 GB - SATA-300",
|
47
|
+
"manu":"Maxtor Corp.",
|
48
|
+
"price":350.0,
|
49
|
+
"popularity":6,
|
50
|
+
"inStock":true,
|
51
|
+
"store":"45.17614,-93.87341",
|
52
|
+
"manufacturedate_dt":"2006-02-13T15:26:37Z",
|
53
|
+
"cat":["electronics","hard drive"],
|
54
|
+
"features":[
|
55
|
+
"SATA 3.0Gb/s, NCQ",
|
56
|
+
"8.5ms seek",
|
57
|
+
"16MB cache"],
|
58
|
+
"score":1.0},
|
59
|
+
{
|
60
|
+
"id":"F8V7067-APL-KIT",
|
61
|
+
"name":"Belkin Mobile Power Cord for iPod w/ Dock",
|
62
|
+
"manu":"Belkin",
|
63
|
+
"weight":4.0,
|
64
|
+
"price":19.95,
|
65
|
+
"popularity":1,
|
66
|
+
"inStock":false,
|
67
|
+
"store":"45.17614,-93.87341",
|
68
|
+
"manufacturedate_dt":"2005-08-01T16:30:25Z",
|
69
|
+
"cat":["electronics","connector"],
|
70
|
+
"features":[
|
71
|
+
"car power adapter, white"],
|
72
|
+
"score":1.0},
|
73
|
+
{
|
74
|
+
"id":"IW-02",
|
75
|
+
"name":"iPod & iPod Mini USB 2.0 Cable",
|
76
|
+
"manu":"Belkin",
|
77
|
+
"weight":2.0,
|
78
|
+
"price":11.5,
|
79
|
+
"popularity":1,
|
80
|
+
"inStock":false,
|
81
|
+
"store":"37.7752,-122.4232",
|
82
|
+
"manufacturedate_dt":"2006-02-14T23:55:59Z",
|
83
|
+
"cat":["electronics","connector"],
|
84
|
+
"features":[
|
85
|
+
"car power adapter for iPod, white"],
|
86
|
+
"score":1.0},
|
87
|
+
{
|
88
|
+
"id":"MA147LL/A",
|
89
|
+
"name":"Apple 60 GB iPod with Video Playback Black",
|
90
|
+
"manu":"Apple Computer Inc.",
|
91
|
+
"includes":"earbud headphones, USB cable",
|
92
|
+
"weight":5.5,
|
93
|
+
"price":399.0,
|
94
|
+
"popularity":10,
|
95
|
+
"inStock":true,
|
96
|
+
"store":"37.7752,-100.0232",
|
97
|
+
"manufacturedate_dt":"2005-10-12T08:00:00Z",
|
98
|
+
"cat":["electronics","music"],
|
99
|
+
"features":[
|
100
|
+
"iTunes, Podcasts, Audiobooks",
|
101
|
+
"Stores up to 15,000 songs, 25,000 photos, or 150 hours of video",
|
102
|
+
"2.5-inch, 320x240 color TFT LCD display with LED backlight",
|
103
|
+
"Up to 20 hours of battery life",
|
104
|
+
"Plays AAC, MP3, WAV, AIFF, Audible, Apple Lossless, H.264 video",
|
105
|
+
"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"],
|
106
|
+
"score":1.0},
|
107
|
+
{
|
108
|
+
"id":"TWINX2048-3200PRO",
|
109
|
+
"name":"CORSAIR XMS 2GB (2 x 1GB) 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) Dual Channel Kit System Memory - Retail",
|
110
|
+
"manu":"Corsair Microsystems Inc.",
|
111
|
+
"price":185.0,
|
112
|
+
"popularity":5,
|
113
|
+
"inStock":true,
|
114
|
+
"store":"37.7752,-122.4232",
|
115
|
+
"manufacturedate_dt":"2006-02-13T15:26:37Z",
|
116
|
+
"payloads":"electronics|6.0 memory|3.0",
|
117
|
+
"cat":["electronics","memory"],
|
118
|
+
"features":[
|
119
|
+
"CAS latency 2,\t2-3-3-6 timing, 2.75v, unbuffered, heat-spreader"],
|
120
|
+
"score":1.0},
|
121
|
+
{
|
122
|
+
"id":"VS1GB400C3",
|
123
|
+
"name":"CORSAIR ValueSelect 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - Retail",
|
124
|
+
"manu":"Corsair Microsystems Inc.",
|
125
|
+
"price":74.99,
|
126
|
+
"popularity":7,
|
127
|
+
"inStock":true,
|
128
|
+
"store":"37.7752,-100.0232",
|
129
|
+
"manufacturedate_dt":"2006-02-13T15:26:37Z",
|
130
|
+
"payloads":"electronics|4.0 memory|2.0",
|
131
|
+
"cat":["electronics","memory"],
|
132
|
+
"score":1.0},
|
133
|
+
{
|
134
|
+
"id":"VDBDB1A16",
|
135
|
+
"name":"A-DATA V-Series 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - OEM",
|
136
|
+
"manu":"A-DATA Technology Inc.",
|
137
|
+
"popularity":0,
|
138
|
+
"inStock":true,
|
139
|
+
"store":"45.17614,-93.87341",
|
140
|
+
"manufacturedate_dt":"2006-02-13T15:26:37Z",
|
141
|
+
"payloads":"electronics|0.9 memory|0.1",
|
142
|
+
"cat":["electronics","memory"],
|
143
|
+
"features":[
|
144
|
+
"CAS latency 3,\t 2.7v"],
|
145
|
+
"score":1.0},
|
146
|
+
{
|
147
|
+
"id":"3007WFP",
|
148
|
+
"name":"Dell Widescreen UltraSharp 3007WFP",
|
149
|
+
"manu":"Dell, Inc.",
|
150
|
+
"includes":"USB cable",
|
151
|
+
"weight":401.6,
|
152
|
+
"price":2199.0,
|
153
|
+
"popularity":6,
|
154
|
+
"inStock":true,
|
155
|
+
"store":"43.17614,-90.57341",
|
156
|
+
"cat":["electronics","monitor"],
|
157
|
+
"features":[
|
158
|
+
"30\" TFT active matrix LCD, 2560 x 1600, .25mm dot pitch, 700:1 contrast"],
|
159
|
+
"score":1.0},
|
160
|
+
{
|
161
|
+
"id":"VA902B",
|
162
|
+
"name":"ViewSonic VA902B - flat panel display - TFT - 19\"",
|
163
|
+
"manu":"ViewSonic Corp.",
|
164
|
+
"weight":190.4,
|
165
|
+
"price":279.95,
|
166
|
+
"popularity":6,
|
167
|
+
"inStock":true,
|
168
|
+
"store":"45.17614,-93.87341",
|
169
|
+
"cat":["electronics","monitor"],
|
170
|
+
"features":[
|
171
|
+
"19\" TFT active matrix LCD, 8ms response time, 1280 x 1024 native resolution"],
|
172
|
+
"score":1.0},
|
173
|
+
{
|
174
|
+
"id":"0579B002",
|
175
|
+
"name":"Canon PIXMA MP500 All-In-One Photo Printer",
|
176
|
+
"manu":"Canon Inc.",
|
177
|
+
"weight":352.0,
|
178
|
+
"price":179.99,
|
179
|
+
"popularity":6,
|
180
|
+
"inStock":true,
|
181
|
+
"store":"45.17614,-93.87341",
|
182
|
+
"cat":["electronics","multifunction printer","printer","scanner","copier"],
|
183
|
+
"features":[
|
184
|
+
"Multifunction ink-jet color photo printer",
|
185
|
+
"Flatbed scanner, optical scan resolution of 1,200 x 2,400 dpi",
|
186
|
+
"2.5\" color LCD preview screen",
|
187
|
+
"Duplex Copying",
|
188
|
+
"Printing speed up to 29ppm black, 19ppm color",
|
189
|
+
"Hi-Speed USB",
|
190
|
+
"memory card: CompactFlash, Micro Drive, SmartMedia, Memory Stick, Memory Stick Pro, SD Card, and MultiMediaCard"],
|
191
|
+
"score":1.0},
|
192
|
+
{
|
193
|
+
"id":"9885A004",
|
194
|
+
"name":"Canon PowerShot SD500",
|
195
|
+
"manu":"Canon Inc.",
|
196
|
+
"includes":"32MB SD card, USB cable, AV cable, battery",
|
197
|
+
"weight":6.4,
|
198
|
+
"price":329.95,
|
199
|
+
"popularity":7,
|
200
|
+
"inStock":true,
|
201
|
+
"manufacturedate_dt":"2006-02-13T15:26:37Z",
|
202
|
+
"store":"45.17614,-93.87341",
|
203
|
+
"cat":["electronics","camera"],
|
204
|
+
"features":[
|
205
|
+
"3x zoop, 7.1 megapixel Digital ELPH",
|
206
|
+
"movie clips up to 640x480 @30 fps",
|
207
|
+
"2.0\" TFT LCD, 118,000 pixels",
|
208
|
+
"built in flash, red-eye reduction"],
|
209
|
+
"score":1.0},
|
210
|
+
{
|
211
|
+
"id":"SOLR1000",
|
212
|
+
"name":"Solr, the Enterprise Search Server",
|
213
|
+
"manu":"Apache Software Foundation",
|
214
|
+
"price":0.0,
|
215
|
+
"popularity":10,
|
216
|
+
"inStock":true,
|
217
|
+
"incubationdate_dt":"2006-01-17T00:00:00Z",
|
218
|
+
"cat":["software","search"],
|
219
|
+
"features":[
|
220
|
+
"Advanced Full-Text Search Capabilities using Lucene",
|
221
|
+
"Optimized for High Volume Web Traffic",
|
222
|
+
"Standards Based Open Interfaces - XML and HTTP",
|
223
|
+
"Comprehensive HTML Administration Interfaces",
|
224
|
+
"Scalability - Efficient Replication to other Solr Search Servers",
|
225
|
+
"Flexible and Adaptable with XML configuration and Schema",
|
226
|
+
"Good unicode support: héllo (hello with an accent over the e)"],
|
227
|
+
"score":1.0},
|
228
|
+
{
|
229
|
+
"id":"UTF8TEST",
|
230
|
+
"name":"Test with some UTF-8 encoded characters",
|
231
|
+
"manu":"Apache Software Foundation",
|
232
|
+
"price":0.0,
|
233
|
+
"inStock":true,
|
234
|
+
"cat":["software","search"],
|
235
|
+
"features":[
|
236
|
+
"No accents here",
|
237
|
+
"This is an e acute: é",
|
238
|
+
"eaiou with circumflexes: êâîôû",
|
239
|
+
"eaiou with umlauts: ëäïöü",
|
240
|
+
"tag with escaped chars: <nicetag/>",
|
241
|
+
"escaped ampersand: Bonnie & Clyde"],
|
242
|
+
"score":1.0},
|
243
|
+
{
|
244
|
+
"id":"EN7800GTX/2DHTV/256M",
|
245
|
+
"name":"ASUS Extreme N7800GTX/2DHTV (256 MB)",
|
246
|
+
"manu":"ASUS Computer Inc.",
|
247
|
+
"weight":16.0,
|
248
|
+
"price":479.95,
|
249
|
+
"popularity":7,
|
250
|
+
"store":"40.7143,-74.006",
|
251
|
+
"inStock":false,
|
252
|
+
"manufacturedate_dt":"2006-02-13T00:00:00Z",
|
253
|
+
"cat":["electronics","graphics card"],
|
254
|
+
"features":[
|
255
|
+
"NVIDIA GeForce 7800 GTX GPU/VPU clocked at 486MHz",
|
256
|
+
"256MB GDDR3 Memory clocked at 1.35GHz",
|
257
|
+
"PCI Express x16",
|
258
|
+
"Dual DVI connectors, HDTV out, video input",
|
259
|
+
"OpenGL 2.0, DirectX 9.0"],
|
260
|
+
"score":1.0},
|
261
|
+
{
|
262
|
+
"id":"100-435805",
|
263
|
+
"name":"ATI Radeon X1900 XTX 512 MB PCIE Video Card",
|
264
|
+
"manu":"ATI Technologies",
|
265
|
+
"weight":48.0,
|
266
|
+
"price":649.99,
|
267
|
+
"popularity":7,
|
268
|
+
"inStock":false,
|
269
|
+
"manufacturedate_dt":"2006-02-13T00:00:00Z",
|
270
|
+
"store":"40.7143,-74.006",
|
271
|
+
"cat":["electronics","graphics card"],
|
272
|
+
"features":[
|
273
|
+
"ATI RADEON X1900 GPU/VPU clocked at 650MHz",
|
274
|
+
"512MB GDDR3 SDRAM clocked at 1.55GHz",
|
275
|
+
"PCI Express x16",
|
276
|
+
"dual DVI, HDTV, svideo, composite out",
|
277
|
+
"OpenGL 2.0, DirectX 9.0"],
|
278
|
+
"score":1.0}]
|
279
|
+
}}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
{
|
2
|
+
"responseHeader":{
|
3
|
+
"status":0,
|
4
|
+
"QTime":2,
|
5
|
+
"params":{
|
6
|
+
"explainOther":"",
|
7
|
+
"fl":"*,score",
|
8
|
+
"indent":"on",
|
9
|
+
"start":"0",
|
10
|
+
"q":"software",
|
11
|
+
"hl.fl":"",
|
12
|
+
"qt":"",
|
13
|
+
"wt":"json",
|
14
|
+
"fq":"",
|
15
|
+
"version":"2.2",
|
16
|
+
"rows":"100"}},
|
17
|
+
"response":{"numFound":2,"start":0,"maxScore":0.6042672,"docs":[
|
18
|
+
{
|
19
|
+
"id":"UTF8TEST",
|
20
|
+
"name":"Test with some UTF-8 encoded characters",
|
21
|
+
"manu":"Apache Software Foundation",
|
22
|
+
"price":0.0,
|
23
|
+
"inStock":true,
|
24
|
+
"cat":["software","search"],
|
25
|
+
"features":[
|
26
|
+
"No accents here",
|
27
|
+
"This is an e acute: é",
|
28
|
+
"eaiou with circumflexes: êâîôû",
|
29
|
+
"eaiou with umlauts: ëäïöü",
|
30
|
+
"tag with escaped chars: <nicetag/>",
|
31
|
+
"escaped ampersand: Bonnie & Clyde"],
|
32
|
+
"score":0.6042672},
|
33
|
+
{
|
34
|
+
"id":"SOLR1000",
|
35
|
+
"name":"Solr, the Enterprise Search Server",
|
36
|
+
"manu":"Apache Software Foundation",
|
37
|
+
"price":0.0,
|
38
|
+
"popularity":10,
|
39
|
+
"inStock":true,
|
40
|
+
"incubationdate_dt":"2006-01-17T00:00:00Z",
|
41
|
+
"cat":["software","search"],
|
42
|
+
"features":[
|
43
|
+
"Advanced Full-Text Search Capabilities using Lucene",
|
44
|
+
"Optimized for High Volume Web Traffic",
|
45
|
+
"Standards Based Open Interfaces - XML and HTTP",
|
46
|
+
"Comprehensive HTML Administration Interfaces",
|
47
|
+
"Scalability - Efficient Replication to other Solr Search Servers",
|
48
|
+
"Flexible and Adaptable with XML configuration and Schema",
|
49
|
+
"Good unicode support: héllo (hello with an accent over the e)"],
|
50
|
+
"score":0.48341373}]
|
51
|
+
}}
|
@@ -0,0 +1,279 @@
|
|
1
|
+
{
|
2
|
+
'responseHeader'=>{
|
3
|
+
'status'=>0,
|
4
|
+
'QTime'=>1,
|
5
|
+
'params'=>{
|
6
|
+
'explainOther'=>'',
|
7
|
+
'fl'=>'*,score',
|
8
|
+
'indent'=>'on',
|
9
|
+
'start'=>'0',
|
10
|
+
'q'=>'*:*',
|
11
|
+
'hl.fl'=>'',
|
12
|
+
'qt'=>'',
|
13
|
+
'wt'=>'ruby',
|
14
|
+
'fq'=>'',
|
15
|
+
'version'=>'2.2',
|
16
|
+
'rows'=>'100'}},
|
17
|
+
'response'=>{'numFound'=>17,'start'=>0,'maxScore'=>1.0,'docs'=>[
|
18
|
+
{
|
19
|
+
'id'=>'GB18030TEST',
|
20
|
+
'name'=>'Test with some GB18030 encoded characters',
|
21
|
+
'price'=>0.0,
|
22
|
+
'inStock'=>true,
|
23
|
+
'features'=>[
|
24
|
+
'No accents here',
|
25
|
+
'这是一个功能',
|
26
|
+
'This is a feature (translated)',
|
27
|
+
'这份文件是很有光泽',
|
28
|
+
'This document is very shiny (translated)'],
|
29
|
+
'score'=>1.0},
|
30
|
+
{
|
31
|
+
'id'=>'SP2514N',
|
32
|
+
'name'=>'Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133',
|
33
|
+
'manu'=>'Samsung Electronics Co. Ltd.',
|
34
|
+
'price'=>92.0,
|
35
|
+
'popularity'=>6,
|
36
|
+
'inStock'=>true,
|
37
|
+
'manufacturedate_dt'=>'2006-02-13T15:26:37Z',
|
38
|
+
'store'=>'35.0752,-97.032',
|
39
|
+
'cat'=>['electronics','hard drive'],
|
40
|
+
'features'=>[
|
41
|
+
'7200RPM, 8MB cache, IDE Ultra ATA-133',
|
42
|
+
'NoiseGuard, SilentSeek technology, Fluid Dynamic Bearing (FDB) motor'],
|
43
|
+
'score'=>1.0},
|
44
|
+
{
|
45
|
+
'id'=>'6H500F0',
|
46
|
+
'name'=>'Maxtor DiamondMax 11 - hard drive - 500 GB - SATA-300',
|
47
|
+
'manu'=>'Maxtor Corp.',
|
48
|
+
'price'=>350.0,
|
49
|
+
'popularity'=>6,
|
50
|
+
'inStock'=>true,
|
51
|
+
'store'=>'45.17614,-93.87341',
|
52
|
+
'manufacturedate_dt'=>'2006-02-13T15:26:37Z',
|
53
|
+
'cat'=>['electronics','hard drive'],
|
54
|
+
'features'=>[
|
55
|
+
'SATA 3.0Gb/s, NCQ',
|
56
|
+
'8.5ms seek',
|
57
|
+
'16MB cache'],
|
58
|
+
'score'=>1.0},
|
59
|
+
{
|
60
|
+
'id'=>'F8V7067-APL-KIT',
|
61
|
+
'name'=>'Belkin Mobile Power Cord for iPod w/ Dock',
|
62
|
+
'manu'=>'Belkin',
|
63
|
+
'weight'=>4.0,
|
64
|
+
'price'=>19.95,
|
65
|
+
'popularity'=>1,
|
66
|
+
'inStock'=>false,
|
67
|
+
'store'=>'45.17614,-93.87341',
|
68
|
+
'manufacturedate_dt'=>'2005-08-01T16:30:25Z',
|
69
|
+
'cat'=>['electronics','connector'],
|
70
|
+
'features'=>[
|
71
|
+
'car power adapter, white'],
|
72
|
+
'score'=>1.0},
|
73
|
+
{
|
74
|
+
'id'=>'IW-02',
|
75
|
+
'name'=>'iPod & iPod Mini USB 2.0 Cable',
|
76
|
+
'manu'=>'Belkin',
|
77
|
+
'weight'=>2.0,
|
78
|
+
'price'=>11.5,
|
79
|
+
'popularity'=>1,
|
80
|
+
'inStock'=>false,
|
81
|
+
'store'=>'37.7752,-122.4232',
|
82
|
+
'manufacturedate_dt'=>'2006-02-14T23:55:59Z',
|
83
|
+
'cat'=>['electronics','connector'],
|
84
|
+
'features'=>[
|
85
|
+
'car power adapter for iPod, white'],
|
86
|
+
'score'=>1.0},
|
87
|
+
{
|
88
|
+
'id'=>'MA147LL/A',
|
89
|
+
'name'=>'Apple 60 GB iPod with Video Playback Black',
|
90
|
+
'manu'=>'Apple Computer Inc.',
|
91
|
+
'includes'=>'earbud headphones, USB cable',
|
92
|
+
'weight'=>5.5,
|
93
|
+
'price'=>399.0,
|
94
|
+
'popularity'=>10,
|
95
|
+
'inStock'=>true,
|
96
|
+
'store'=>'37.7752,-100.0232',
|
97
|
+
'manufacturedate_dt'=>'2005-10-12T08:00:00Z',
|
98
|
+
'cat'=>['electronics','music'],
|
99
|
+
'features'=>[
|
100
|
+
'iTunes, Podcasts, Audiobooks',
|
101
|
+
'Stores up to 15,000 songs, 25,000 photos, or 150 hours of video',
|
102
|
+
'2.5-inch, 320x240 color TFT LCD display with LED backlight',
|
103
|
+
'Up to 20 hours of battery life',
|
104
|
+
'Plays AAC, MP3, WAV, AIFF, Audible, Apple Lossless, H.264 video',
|
105
|
+
'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'],
|
106
|
+
'score'=>1.0},
|
107
|
+
{
|
108
|
+
'id'=>'TWINX2048-3200PRO',
|
109
|
+
'name'=>'CORSAIR XMS 2GB (2 x 1GB) 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) Dual Channel Kit System Memory - Retail',
|
110
|
+
'manu'=>'Corsair Microsystems Inc.',
|
111
|
+
'price'=>185.0,
|
112
|
+
'popularity'=>5,
|
113
|
+
'inStock'=>true,
|
114
|
+
'store'=>'37.7752,-122.4232',
|
115
|
+
'manufacturedate_dt'=>'2006-02-13T15:26:37Z',
|
116
|
+
'payloads'=>'electronics|6.0 memory|3.0',
|
117
|
+
'cat'=>['electronics','memory'],
|
118
|
+
'features'=>[
|
119
|
+
'CAS latency 2, 2-3-3-6 timing, 2.75v, unbuffered, heat-spreader'],
|
120
|
+
'score'=>1.0},
|
121
|
+
{
|
122
|
+
'id'=>'VS1GB400C3',
|
123
|
+
'name'=>'CORSAIR ValueSelect 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - Retail',
|
124
|
+
'manu'=>'Corsair Microsystems Inc.',
|
125
|
+
'price'=>74.99,
|
126
|
+
'popularity'=>7,
|
127
|
+
'inStock'=>true,
|
128
|
+
'store'=>'37.7752,-100.0232',
|
129
|
+
'manufacturedate_dt'=>'2006-02-13T15:26:37Z',
|
130
|
+
'payloads'=>'electronics|4.0 memory|2.0',
|
131
|
+
'cat'=>['electronics','memory'],
|
132
|
+
'score'=>1.0},
|
133
|
+
{
|
134
|
+
'id'=>'VDBDB1A16',
|
135
|
+
'name'=>'A-DATA V-Series 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - OEM',
|
136
|
+
'manu'=>'A-DATA Technology Inc.',
|
137
|
+
'popularity'=>0,
|
138
|
+
'inStock'=>true,
|
139
|
+
'store'=>'45.17614,-93.87341',
|
140
|
+
'manufacturedate_dt'=>'2006-02-13T15:26:37Z',
|
141
|
+
'payloads'=>'electronics|0.9 memory|0.1',
|
142
|
+
'cat'=>['electronics','memory'],
|
143
|
+
'features'=>[
|
144
|
+
'CAS latency 3, 2.7v'],
|
145
|
+
'score'=>1.0},
|
146
|
+
{
|
147
|
+
'id'=>'3007WFP',
|
148
|
+
'name'=>'Dell Widescreen UltraSharp 3007WFP',
|
149
|
+
'manu'=>'Dell, Inc.',
|
150
|
+
'includes'=>'USB cable',
|
151
|
+
'weight'=>401.6,
|
152
|
+
'price'=>2199.0,
|
153
|
+
'popularity'=>6,
|
154
|
+
'inStock'=>true,
|
155
|
+
'store'=>'43.17614,-90.57341',
|
156
|
+
'cat'=>['electronics','monitor'],
|
157
|
+
'features'=>[
|
158
|
+
'30" TFT active matrix LCD, 2560 x 1600, .25mm dot pitch, 700:1 contrast'],
|
159
|
+
'score'=>1.0},
|
160
|
+
{
|
161
|
+
'id'=>'VA902B',
|
162
|
+
'name'=>'ViewSonic VA902B - flat panel display - TFT - 19"',
|
163
|
+
'manu'=>'ViewSonic Corp.',
|
164
|
+
'weight'=>190.4,
|
165
|
+
'price'=>279.95,
|
166
|
+
'popularity'=>6,
|
167
|
+
'inStock'=>true,
|
168
|
+
'store'=>'45.17614,-93.87341',
|
169
|
+
'cat'=>['electronics','monitor'],
|
170
|
+
'features'=>[
|
171
|
+
'19" TFT active matrix LCD, 8ms response time, 1280 x 1024 native resolution'],
|
172
|
+
'score'=>1.0},
|
173
|
+
{
|
174
|
+
'id'=>'0579B002',
|
175
|
+
'name'=>'Canon PIXMA MP500 All-In-One Photo Printer',
|
176
|
+
'manu'=>'Canon Inc.',
|
177
|
+
'weight'=>352.0,
|
178
|
+
'price'=>179.99,
|
179
|
+
'popularity'=>6,
|
180
|
+
'inStock'=>true,
|
181
|
+
'store'=>'45.17614,-93.87341',
|
182
|
+
'cat'=>['electronics','multifunction printer','printer','scanner','copier'],
|
183
|
+
'features'=>[
|
184
|
+
'Multifunction ink-jet color photo printer',
|
185
|
+
'Flatbed scanner, optical scan resolution of 1,200 x 2,400 dpi',
|
186
|
+
'2.5" color LCD preview screen',
|
187
|
+
'Duplex Copying',
|
188
|
+
'Printing speed up to 29ppm black, 19ppm color',
|
189
|
+
'Hi-Speed USB',
|
190
|
+
'memory card: CompactFlash, Micro Drive, SmartMedia, Memory Stick, Memory Stick Pro, SD Card, and MultiMediaCard'],
|
191
|
+
'score'=>1.0},
|
192
|
+
{
|
193
|
+
'id'=>'9885A004',
|
194
|
+
'name'=>'Canon PowerShot SD500',
|
195
|
+
'manu'=>'Canon Inc.',
|
196
|
+
'includes'=>'32MB SD card, USB cable, AV cable, battery',
|
197
|
+
'weight'=>6.4,
|
198
|
+
'price'=>329.95,
|
199
|
+
'popularity'=>7,
|
200
|
+
'inStock'=>true,
|
201
|
+
'manufacturedate_dt'=>'2006-02-13T15:26:37Z',
|
202
|
+
'store'=>'45.17614,-93.87341',
|
203
|
+
'cat'=>['electronics','camera'],
|
204
|
+
'features'=>[
|
205
|
+
'3x zoop, 7.1 megapixel Digital ELPH',
|
206
|
+
'movie clips up to 640x480 @30 fps',
|
207
|
+
'2.0" TFT LCD, 118,000 pixels',
|
208
|
+
'built in flash, red-eye reduction'],
|
209
|
+
'score'=>1.0},
|
210
|
+
{
|
211
|
+
'id'=>'SOLR1000',
|
212
|
+
'name'=>'Solr, the Enterprise Search Server',
|
213
|
+
'manu'=>'Apache Software Foundation',
|
214
|
+
'price'=>0.0,
|
215
|
+
'popularity'=>10,
|
216
|
+
'inStock'=>true,
|
217
|
+
'incubationdate_dt'=>'2006-01-17T00:00:00Z',
|
218
|
+
'cat'=>['software','search'],
|
219
|
+
'features'=>[
|
220
|
+
'Advanced Full-Text Search Capabilities using Lucene',
|
221
|
+
'Optimized for High Volume Web Traffic',
|
222
|
+
'Standards Based Open Interfaces - XML and HTTP',
|
223
|
+
'Comprehensive HTML Administration Interfaces',
|
224
|
+
'Scalability - Efficient Replication to other Solr Search Servers',
|
225
|
+
'Flexible and Adaptable with XML configuration and Schema',
|
226
|
+
'Good unicode support: héllo (hello with an accent over the e)'],
|
227
|
+
'score'=>1.0},
|
228
|
+
{
|
229
|
+
'id'=>'UTF8TEST',
|
230
|
+
'name'=>'Test with some UTF-8 encoded characters',
|
231
|
+
'manu'=>'Apache Software Foundation',
|
232
|
+
'price'=>0.0,
|
233
|
+
'inStock'=>true,
|
234
|
+
'cat'=>['software','search'],
|
235
|
+
'features'=>[
|
236
|
+
'No accents here',
|
237
|
+
'This is an e acute: é',
|
238
|
+
'eaiou with circumflexes: êâîôû',
|
239
|
+
'eaiou with umlauts: ëäïöü',
|
240
|
+
'tag with escaped chars: <nicetag/>',
|
241
|
+
'escaped ampersand: Bonnie & Clyde'],
|
242
|
+
'score'=>1.0},
|
243
|
+
{
|
244
|
+
'id'=>'EN7800GTX/2DHTV/256M',
|
245
|
+
'name'=>'ASUS Extreme N7800GTX/2DHTV (256 MB)',
|
246
|
+
'manu'=>'ASUS Computer Inc.',
|
247
|
+
'weight'=>16.0,
|
248
|
+
'price'=>479.95,
|
249
|
+
'popularity'=>7,
|
250
|
+
'store'=>'40.7143,-74.006',
|
251
|
+
'inStock'=>false,
|
252
|
+
'manufacturedate_dt'=>'2006-02-13T00:00:00Z',
|
253
|
+
'cat'=>['electronics','graphics card'],
|
254
|
+
'features'=>[
|
255
|
+
'NVIDIA GeForce 7800 GTX GPU/VPU clocked at 486MHz',
|
256
|
+
'256MB GDDR3 Memory clocked at 1.35GHz',
|
257
|
+
'PCI Express x16',
|
258
|
+
'Dual DVI connectors, HDTV out, video input',
|
259
|
+
'OpenGL 2.0, DirectX 9.0'],
|
260
|
+
'score'=>1.0},
|
261
|
+
{
|
262
|
+
'id'=>'100-435805',
|
263
|
+
'name'=>'ATI Radeon X1900 XTX 512 MB PCIE Video Card',
|
264
|
+
'manu'=>'ATI Technologies',
|
265
|
+
'weight'=>48.0,
|
266
|
+
'price'=>649.99,
|
267
|
+
'popularity'=>7,
|
268
|
+
'inStock'=>false,
|
269
|
+
'manufacturedate_dt'=>'2006-02-13T00:00:00Z',
|
270
|
+
'store'=>'40.7143,-74.006',
|
271
|
+
'cat'=>['electronics','graphics card'],
|
272
|
+
'features'=>[
|
273
|
+
'ATI RADEON X1900 GPU/VPU clocked at 650MHz',
|
274
|
+
'512MB GDDR3 SDRAM clocked at 1.55GHz',
|
275
|
+
'PCI Express x16',
|
276
|
+
'dual DVI, HDTV, svideo, composite out',
|
277
|
+
'OpenGL 2.0, DirectX 9.0'],
|
278
|
+
'score'=>1.0}]
|
279
|
+
}}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
{
|
2
|
+
'responseHeader'=>{
|
3
|
+
'status'=>0,
|
4
|
+
'QTime'=>0,
|
5
|
+
'params'=>{
|
6
|
+
'explainOther'=>'',
|
7
|
+
'fl'=>'*,score',
|
8
|
+
'indent'=>'on',
|
9
|
+
'start'=>'0',
|
10
|
+
'q'=>'software',
|
11
|
+
'hl.fl'=>'',
|
12
|
+
'qt'=>'',
|
13
|
+
'wt'=>'ruby',
|
14
|
+
'fq'=>'',
|
15
|
+
'version'=>'2.2',
|
16
|
+
'rows'=>'100'}},
|
17
|
+
'response'=>{'numFound'=>2,'start'=>0,'maxScore'=>0.6042672,'docs'=>[
|
18
|
+
{
|
19
|
+
'id'=>'UTF8TEST',
|
20
|
+
'name'=>'Test with some UTF-8 encoded characters',
|
21
|
+
'manu'=>'Apache Software Foundation',
|
22
|
+
'price'=>0.0,
|
23
|
+
'inStock'=>true,
|
24
|
+
'cat'=>['software','search'],
|
25
|
+
'features'=>[
|
26
|
+
'No accents here',
|
27
|
+
'This is an e acute: é',
|
28
|
+
'eaiou with circumflexes: êâîôû',
|
29
|
+
'eaiou with umlauts: ëäïöü',
|
30
|
+
'tag with escaped chars: <nicetag/>',
|
31
|
+
'escaped ampersand: Bonnie & Clyde'],
|
32
|
+
'score'=>0.6042672},
|
33
|
+
{
|
34
|
+
'id'=>'SOLR1000',
|
35
|
+
'name'=>'Solr, the Enterprise Search Server',
|
36
|
+
'manu'=>'Apache Software Foundation',
|
37
|
+
'price'=>0.0,
|
38
|
+
'popularity'=>10,
|
39
|
+
'inStock'=>true,
|
40
|
+
'incubationdate_dt'=>'2006-01-17T00:00:00Z',
|
41
|
+
'cat'=>['software','search'],
|
42
|
+
'features'=>[
|
43
|
+
'Advanced Full-Text Search Capabilities using Lucene',
|
44
|
+
'Optimized for High Volume Web Traffic',
|
45
|
+
'Standards Based Open Interfaces - XML and HTTP',
|
46
|
+
'Comprehensive HTML Administration Interfaces',
|
47
|
+
'Scalability - Efficient Replication to other Solr Search Servers',
|
48
|
+
'Flexible and Adaptable with XML configuration and Schema',
|
49
|
+
'Good unicode support: héllo (hello with an accent over the e)'],
|
50
|
+
'score'=>0.48341373}]
|
51
|
+
}}
|
data/how_to_release.txt
CHANGED
@@ -3,12 +3,12 @@
|
|
3
3
|
* vim CHANGELOG
|
4
4
|
* vim README.rdoc
|
5
5
|
* vim lib/java_bin/version.rb
|
6
|
-
* rake version:bump:patch
|
6
|
+
* rake version:bump:patch (major / minor)
|
7
7
|
* rake gemspec
|
8
8
|
* git commit -a -m "release x.x.x"
|
9
9
|
* git tag vx.x.x
|
10
10
|
* git push
|
11
11
|
* git push --tags
|
12
|
-
* rake
|
12
|
+
* rake rubygems:release
|
13
13
|
|
14
14
|
|
data/java_bin.gemspec
CHANGED
@@ -1,67 +1,65 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{java_bin}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.4.0"
|
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 = %q{
|
12
|
+
s.date = %q{2011-06-21}
|
13
13
|
s.description = %q{Apache Solr JavaBin format (binary format) implementation for Ruby.}
|
14
14
|
s.email = %q{kennyj@gmail.com}
|
15
15
|
s.extensions = ["ext/java_bin/ext/extconf.rb"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"LICENSE",
|
18
|
-
|
18
|
+
"README.rdoc"
|
19
19
|
]
|
20
20
|
s.files = [
|
21
21
|
".document",
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
22
|
+
"CHANGELOG",
|
23
|
+
"LICENSE",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"ext/java_bin/ext/byteswap.h",
|
28
|
+
"ext/java_bin/ext/extconf.rb",
|
29
|
+
"ext/java_bin/ext/parser.c",
|
30
|
+
"ext/java_bin/ext/parser.h",
|
31
|
+
"fixtures/fixtures_for_solr3.1/javabin_all.dat",
|
32
|
+
"fixtures/fixtures_for_solr3.1/javabin_software.dat",
|
33
|
+
"fixtures/fixtures_for_solr3.1/json_all.dat",
|
34
|
+
"fixtures/fixtures_for_solr3.1/json_software.dat",
|
35
|
+
"fixtures/fixtures_for_solr3.1/ruby_all.dat",
|
36
|
+
"fixtures/fixtures_for_solr3.1/ruby_software.dat",
|
37
|
+
"fixtures/javabin.dat",
|
38
|
+
"fixtures/javabin2.dat",
|
39
|
+
"fixtures/json.dat",
|
40
|
+
"fixtures/json2.dat",
|
41
|
+
"fixtures/ruby.dat",
|
42
|
+
"fixtures/ruby2.dat",
|
43
|
+
"how_to_release.txt",
|
44
|
+
"java_bin.gemspec",
|
45
|
+
"lib/java_bin.rb",
|
46
|
+
"lib/java_bin/ext.rb",
|
47
|
+
"lib/java_bin/ext/.keep",
|
48
|
+
"lib/java_bin/pure.rb",
|
49
|
+
"lib/java_bin/pure/parser.rb",
|
50
|
+
"lib/java_bin/version.rb",
|
51
|
+
"lib/rsolr_support.rb",
|
52
|
+
"lib/solr_ruby_support.rb",
|
53
|
+
"test/helper.rb",
|
54
|
+
"test/test_java_bin_parser.rb",
|
55
|
+
"test/xxx_performance.rb"
|
51
56
|
]
|
52
57
|
s.homepage = %q{http://github.com/kennyj/java_bin}
|
53
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
54
58
|
s.require_paths = ["lib", "ext"]
|
55
|
-
s.rubygems_version = %q{1.
|
59
|
+
s.rubygems_version = %q{1.6.2}
|
56
60
|
s.summary = %q{Apache Solr JavaBin format implementation for Ruby.}
|
57
|
-
s.test_files = [
|
58
|
-
"test/helper.rb",
|
59
|
-
"test/xxx_performance.rb",
|
60
|
-
"test/test_java_bin_parser.rb"
|
61
|
-
]
|
62
61
|
|
63
62
|
if s.respond_to? :specification_version then
|
64
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
65
63
|
s.specification_version = 3
|
66
64
|
|
67
65
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
data/lib/java_bin/pure/parser.rb
CHANGED
@@ -36,12 +36,12 @@ module JavaBin
|
|
36
36
|
SHIFTED_SINT = SINT >> 5
|
37
37
|
SHIFTED_SLONG = SLONG >> 5
|
38
38
|
|
39
|
-
|
39
|
+
VERSIONS = [1, 2]
|
40
40
|
TERM_OBJ = :term_obj
|
41
41
|
|
42
42
|
class Parser
|
43
43
|
|
44
|
-
attr_reader :tag_byte, :input, :current
|
44
|
+
attr_reader :tag_byte, :input, :current, :version
|
45
45
|
|
46
46
|
def initialize
|
47
47
|
end
|
@@ -49,15 +49,16 @@ module JavaBin
|
|
49
49
|
def parse(input)
|
50
50
|
array = input.unpack("C*")
|
51
51
|
check_version(array[0])
|
52
|
+
@current = 0
|
52
53
|
@input = array
|
53
|
-
@
|
54
|
+
@version = getbyte
|
54
55
|
@tag_byte = nil
|
55
56
|
read_val
|
56
57
|
end
|
57
58
|
|
58
59
|
private
|
59
60
|
def check_version(byte)
|
60
|
-
return true if
|
61
|
+
return true if VERSIONS.include?(byte)
|
61
62
|
raise "unsupported version #{byte}"
|
62
63
|
end
|
63
64
|
|
@@ -192,22 +193,26 @@ module JavaBin
|
|
192
193
|
def read_chars
|
193
194
|
size = read_size
|
194
195
|
str = []
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
196
|
+
if @version == 1
|
197
|
+
size.times {
|
198
|
+
# HINT. read utf-8 char
|
199
|
+
b = getbyte
|
200
|
+
if ((b & 0x80) == 0)
|
201
|
+
str << b
|
202
|
+
elsif ((b & 0xE0) == 0xC0)
|
203
|
+
#str << (((b & 0x1F) << 6) | (getbyte & 0x3F))
|
204
|
+
str << b
|
205
|
+
str << getbyte
|
206
|
+
else
|
207
|
+
#str << (((b & 0x0F) << 12) | ((getbyte & 0x3F) << 6) | (getbyte & 0x3F))
|
208
|
+
str << b
|
209
|
+
str << getbyte
|
210
|
+
str << getbyte
|
211
|
+
end
|
212
|
+
}
|
213
|
+
else
|
214
|
+
size.times { str << getbyte }
|
215
|
+
end
|
211
216
|
str = str.pack("C*")
|
212
217
|
str.force_encoding('utf-8') if str.respond_to? :force_encoding
|
213
218
|
str
|
data/lib/java_bin/version.rb
CHANGED
@@ -61,7 +61,7 @@ class TestJavaBinParser < Test::Unit::TestCase
|
|
61
61
|
assert @parser.parse([1, 1].pack("C*"))
|
62
62
|
end
|
63
63
|
def test_invalid_version
|
64
|
-
assert_raise(RuntimeError) { @parser.parse([
|
64
|
+
assert_raise(RuntimeError) { @parser.parse([3].pack("C*")) }
|
65
65
|
end
|
66
66
|
|
67
67
|
def test_javabin_dat
|
@@ -78,6 +78,22 @@ class TestJavaBinParser < Test::Unit::TestCase
|
|
78
78
|
assert_equal 19, result['response']['docs'].size
|
79
79
|
end
|
80
80
|
|
81
|
+
def test_solr3_1_javabin_software_dat
|
82
|
+
result = @parser.parse(open("fixtures/fixtures_for_solr3.1/javabin_software.dat", READ_ASCII).read)
|
83
|
+
assert result['response']['docs'][0]['features'].include?('eaiou with circumflexes: êâîôû')
|
84
|
+
assert result['response']['docs'][0]['features'].include?('eaiou with umlauts: ëäïöü')
|
85
|
+
assert_equal result['response']['docs'][1]['incubationdate_dt'], Time.local(2006, 1, 17, 9, 0, 0)
|
86
|
+
assert_in_delta result['response']['maxScore'], 0.6042672, 0.0001
|
87
|
+
assert_in_delta result['response']['docs'][0]['score'], 0.6042672, 0.0001
|
88
|
+
assert_in_delta result['response']['docs'][1]['score'], 0.48341373, 0.0001
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_solr3_1_javabin_all_dat
|
92
|
+
result = @parser.parse(open("fixtures/fixtures_for_solr3.1/javabin_all.dat", READ_ASCII).read)
|
93
|
+
assert_equal 17, result['response']['docs'].size
|
94
|
+
assert result['response']['docs'][0]['features'].include?('这是一个功能')
|
95
|
+
end
|
96
|
+
|
81
97
|
def test_javabin_parse_and_ruby_eval_with_time
|
82
98
|
r = eval(open("fixtures/ruby.dat", READ_UTF8).read)
|
83
99
|
jb = @parser.parse(open("fixtures/javabin.dat", READ_ASCII).read)
|
metadata
CHANGED
@@ -1,36 +1,27 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: java_bin
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 3
|
9
|
-
- 5
|
10
|
-
version: 0.3.5
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- kennyj
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2010-05-22 00:00:00 +09:00
|
12
|
+
date: 2011-06-21 00:00:00.000000000 +09:00
|
19
13
|
default_executable:
|
20
14
|
dependencies: []
|
21
|
-
|
22
15
|
description: Apache Solr JavaBin format (binary format) implementation for Ruby.
|
23
16
|
email: kennyj@gmail.com
|
24
17
|
executables: []
|
25
|
-
|
26
|
-
extensions:
|
18
|
+
extensions:
|
27
19
|
- ext/java_bin/ext/extconf.rb
|
28
|
-
extra_rdoc_files:
|
20
|
+
extra_rdoc_files:
|
29
21
|
- LICENSE
|
30
22
|
- README.rdoc
|
31
|
-
files:
|
23
|
+
files:
|
32
24
|
- .document
|
33
|
-
- .gitignore
|
34
25
|
- CHANGELOG
|
35
26
|
- LICENSE
|
36
27
|
- README.rdoc
|
@@ -40,6 +31,12 @@ files:
|
|
40
31
|
- ext/java_bin/ext/extconf.rb
|
41
32
|
- ext/java_bin/ext/parser.c
|
42
33
|
- ext/java_bin/ext/parser.h
|
34
|
+
- fixtures/fixtures_for_solr3.1/javabin_all.dat
|
35
|
+
- fixtures/fixtures_for_solr3.1/javabin_software.dat
|
36
|
+
- fixtures/fixtures_for_solr3.1/json_all.dat
|
37
|
+
- fixtures/fixtures_for_solr3.1/json_software.dat
|
38
|
+
- fixtures/fixtures_for_solr3.1/ruby_all.dat
|
39
|
+
- fixtures/fixtures_for_solr3.1/ruby_software.dat
|
43
40
|
- fixtures/javabin.dat
|
44
41
|
- fixtures/javabin2.dat
|
45
42
|
- fixtures/json.dat
|
@@ -62,39 +59,27 @@ files:
|
|
62
59
|
has_rdoc: true
|
63
60
|
homepage: http://github.com/kennyj/java_bin
|
64
61
|
licenses: []
|
65
|
-
|
66
62
|
post_install_message:
|
67
|
-
rdoc_options:
|
68
|
-
|
69
|
-
require_paths:
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
70
65
|
- lib
|
71
66
|
- ext
|
72
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
68
|
none: false
|
74
|
-
requirements:
|
75
|
-
- -
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
|
78
|
-
|
79
|
-
- 0
|
80
|
-
version: "0"
|
81
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
74
|
none: false
|
83
|
-
requirements:
|
84
|
-
- -
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
|
87
|
-
segments:
|
88
|
-
- 0
|
89
|
-
version: "0"
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
90
79
|
requirements: []
|
91
|
-
|
92
80
|
rubyforge_project:
|
93
|
-
rubygems_version: 1.
|
81
|
+
rubygems_version: 1.6.2
|
94
82
|
signing_key:
|
95
83
|
specification_version: 3
|
96
84
|
summary: Apache Solr JavaBin format implementation for Ruby.
|
97
|
-
test_files:
|
98
|
-
- test/helper.rb
|
99
|
-
- test/xxx_performance.rb
|
100
|
-
- test/test_java_bin_parser.rb
|
85
|
+
test_files: []
|
data/.gitignore
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
## MAC OS
|
2
|
-
.DS_Store
|
3
|
-
|
4
|
-
## TEXTMATE
|
5
|
-
*.tmproj
|
6
|
-
tmtags
|
7
|
-
|
8
|
-
## EMACS
|
9
|
-
*~
|
10
|
-
\#*
|
11
|
-
.\#*
|
12
|
-
|
13
|
-
## VIM
|
14
|
-
*.swp
|
15
|
-
|
16
|
-
## PROJECT::GENERAL
|
17
|
-
coverage
|
18
|
-
rdoc
|
19
|
-
pkg
|
20
|
-
|
21
|
-
## PROJECT::SPECIFIC
|
22
|
-
Makefile
|
23
|
-
*.o
|
24
|
-
*.so
|
25
|
-
*.log
|
26
|
-
*.orig
|
27
|
-
*.def
|
28
|
-
*.exp
|
29
|
-
*.lib
|
30
|
-
*.pdb
|
31
|
-
*.obj
|
32
|
-
*.s
|