ferret 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/Makefile +2 -2
- data/ext/ferret.c +27 -2
- data/ext/ferret.h +59 -16
- data/ext/ferret_ext.so +0 -0
- data/ext/index_io.c +72 -77
- data/ext/priority_queue.c +150 -145
- data/ext/ram_directory.c +47 -42
- data/ext/segment_merge_queue.c +4 -8
- data/ext/segment_term_enum.c +324 -0
- data/ext/similarity.c +59 -0
- data/ext/string_helper.c +2 -2
- data/ext/tags +150 -46
- data/ext/term.c +107 -152
- data/ext/term_buffer.c +105 -174
- data/ext/term_infos_reader.c +54 -0
- data/ext/terminfo.c +160 -0
- data/ext/token.c +93 -0
- data/lib/ferret.rb +1 -1
- data/lib/ferret/analysis/analyzers.rb +18 -0
- data/lib/ferret/analysis/standard_tokenizer.rb +19 -14
- data/lib/ferret/analysis/token.rb +8 -1
- data/lib/ferret/analysis/tokenizers.rb +10 -5
- data/lib/ferret/document/field.rb +33 -11
- data/lib/ferret/index/document_writer.rb +3 -2
- data/lib/ferret/index/field_infos.rb +38 -12
- data/lib/ferret/index/fields_io.rb +10 -4
- data/lib/ferret/index/index.rb +20 -4
- data/lib/ferret/index/index_reader.rb +19 -4
- data/lib/ferret/index/index_writer.rb +1 -1
- data/lib/ferret/index/multi_reader.rb +21 -7
- data/lib/ferret/index/segment_merge_info.rb +24 -22
- data/lib/ferret/index/segment_merge_queue.rb +2 -2
- data/lib/ferret/index/segment_merger.rb +28 -11
- data/lib/ferret/index/segment_reader.rb +19 -4
- data/lib/ferret/index/segment_term_enum.rb +3 -11
- data/lib/ferret/index/term_buffer.rb +13 -16
- data/lib/ferret/index/term_doc_enum.rb +8 -5
- data/lib/ferret/index/term_enum.rb +2 -2
- data/lib/ferret/index/term_info.rb +1 -5
- data/lib/ferret/index/term_infos_io.rb +2 -0
- data/lib/ferret/query_parser/query_parser.tab.rb +7 -7
- data/lib/ferret/search/phrase_scorer.rb +0 -1
- data/lib/ferret/search/similarity.rb +2 -2
- data/lib/ferret/search/term_scorer.rb +2 -2
- data/lib/ferret/store/directory.rb +2 -0
- data/lib/ferret/store/fs_store.rb +16 -3
- data/lib/ferret/store/ram_store.rb +2 -2
- data/test/unit/document/tc_field.rb +9 -0
- data/test/unit/index/tc_field_infos.rb +29 -21
- data/test/unit/index/tc_index.rb +44 -7
- data/test/unit/index/tc_term_buffer.rb +3 -3
- data/test/unit/index/tc_term_info.rb +1 -1
- data/test/unit/query_parser/tc_query_parser.rb +1 -1
- data/test/unit/search/tc_index_searcher.rb +3 -0
- data/test/unit/store/tc_fs_store.rb +47 -16
- data/test/unit/store/tc_ram_store.rb +1 -1
- metadata +8 -3
@@ -8,7 +8,7 @@ class TermBufferTest < Test::Unit::TestCase
|
|
8
8
|
tb = TermBuffer.new
|
9
9
|
tb.term = t
|
10
10
|
assert_equal(t.field, tb.field)
|
11
|
-
assert_equal("Ferret Tutorial", tb.
|
11
|
+
assert_equal("Ferret Tutorial", tb.text)
|
12
12
|
assert_equal("Ferret Tutorial".length, tb.text_length)
|
13
13
|
assert_equal(t, tb.term)
|
14
14
|
end
|
@@ -19,7 +19,7 @@ class TermBufferTest < Test::Unit::TestCase
|
|
19
19
|
tb2 = TermBuffer.new
|
20
20
|
tb2.set!(tb)
|
21
21
|
assert_equal(tb.field, tb2.field)
|
22
|
-
assert_equal("Ferret Tutorial", tb2.
|
22
|
+
assert_equal("Ferret Tutorial", tb2.text)
|
23
23
|
assert_equal("Ferret Tutorial".length, tb2.text_length)
|
24
24
|
assert_equal(tb.term, tb2.term)
|
25
25
|
end
|
@@ -50,7 +50,7 @@ class TermBufferTest < Test::Unit::TestCase
|
|
50
50
|
output.close
|
51
51
|
input = dir.open_input("term_buffer_read_test")
|
52
52
|
tb.read(input, fi)
|
53
|
-
assert_equal("Dave Balmain", tb.
|
53
|
+
assert_equal("Dave Balmain", tb.text)
|
54
54
|
assert_equal("Dave Balmain", tb.term.text)
|
55
55
|
assert_equal("Writer", tb.field)
|
56
56
|
end
|
@@ -9,7 +9,7 @@ class TermInfoTest < Test::Unit::TestCase
|
|
9
9
|
assert_equal(ti1.freq_pointer, 2)
|
10
10
|
assert_equal(ti1.prox_pointer, 3)
|
11
11
|
assert_equal(ti1.skip_offset, 1)
|
12
|
-
ti2 = ti1.
|
12
|
+
ti2 = ti1.clone()
|
13
13
|
assert(ti1 == ti2)
|
14
14
|
ti2 = TermInfo.new(10, 9, 8)
|
15
15
|
assert(ti1 != ti2)
|
@@ -60,25 +60,56 @@ class FSStoreTest < Test::Unit::TestCase
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def test_fslock
|
63
|
-
|
64
|
-
lock_file_path =
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
assert(!
|
69
|
-
|
70
|
-
lock
|
71
|
-
|
72
|
-
|
63
|
+
lock_name = "lfile"
|
64
|
+
lock_file_path = make_lock_file_path(lock_name)
|
65
|
+
assert(! File.exists?(lock_file_path), "There should be no lock file")
|
66
|
+
lock = @dir.make_lock(lock_name)
|
67
|
+
assert(! File.exists?(lock_file_path), "There should still be no lock file")
|
68
|
+
assert(! lock.locked?, "lock shouldn't be locked yet")
|
69
|
+
|
70
|
+
lock.obtain
|
71
|
+
|
72
|
+
assert(lock.locked?, "lock should now be locked")
|
73
|
+
assert(File.exists?(lock_file_path), "A lock file should have been created")
|
74
|
+
|
73
75
|
assert(! @dir.exists?(lock_file_path),
|
74
76
|
"The lock should be hidden by the FSDirectories directory scan")
|
75
|
-
|
76
|
-
lock.obtain
|
77
|
-
assert(lock.locked?, "lock should now be locked")
|
78
|
-
assert(File.exists?(lock_file_path),
|
79
|
-
"A lock file should have been created")
|
77
|
+
|
80
78
|
lock.release
|
81
|
-
|
79
|
+
|
80
|
+
assert(! lock.locked?, "lock should be freed again")
|
82
81
|
assert(! File.exists?(lock_file_path), "The lock file should have been deleted")
|
83
82
|
end
|
83
|
+
|
84
|
+
# def make_and_loose_lock
|
85
|
+
# lock = @dir.make_lock("finalizer_lock")
|
86
|
+
# lock.obtain
|
87
|
+
# lock = nil
|
88
|
+
# end
|
89
|
+
#
|
90
|
+
# def test_fslock_finalizer
|
91
|
+
# lock_name = "finalizer_lock"
|
92
|
+
# lock_file_path = make_lock_file_path(lock_name)
|
93
|
+
# assert(! File.exists?(lock_file_path), "There should be no lock file")
|
94
|
+
#
|
95
|
+
# make_and_loose_lock
|
96
|
+
#
|
97
|
+
# #assert(File.exists?(lock_file_path), "There should now be a lock file")
|
98
|
+
#
|
99
|
+
# lock = @dir.make_lock(lock_name)
|
100
|
+
# assert(lock.locked?, "lock should now be locked")
|
101
|
+
#
|
102
|
+
# GC.start
|
103
|
+
#
|
104
|
+
# assert(! lock.locked?, "lock should be freed again")
|
105
|
+
# assert(! File.exists?(lock_file_path), "The lock file should have been deleted")
|
106
|
+
# end
|
107
|
+
#
|
108
|
+
def make_lock_file_path(name)
|
109
|
+
lock_file_path = File.join(@dpath, @dir.get_lock_prefix() + name)
|
110
|
+
if File.exists?(lock_file_path) then
|
111
|
+
File.delete(lock_file_path)
|
112
|
+
end
|
113
|
+
return lock_file_path
|
114
|
+
end
|
84
115
|
end
|
@@ -15,7 +15,7 @@ class RAMStoreTest < Test::Unit::TestCase
|
|
15
15
|
|
16
16
|
def test_ramlock
|
17
17
|
name = "lfile"
|
18
|
-
lfile =
|
18
|
+
lfile = Ferret::Store::Directory::LOCK_PREFIX + name
|
19
19
|
assert(! @dir.exists?(lfile),
|
20
20
|
"There should be no lock file")
|
21
21
|
lock = @dir.make_lock(name)
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: ferret
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2005-
|
6
|
+
version: 0.3.0
|
7
|
+
date: 2005-12-02 00:00:00 +09:00
|
8
8
|
summary: Ruby indexing library.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -47,9 +47,14 @@ files:
|
|
47
47
|
- ext/term.c
|
48
48
|
- ext/ferret.h
|
49
49
|
- ext/util.c
|
50
|
+
- ext/token.c
|
50
51
|
- ext/tags
|
51
|
-
- ext/ferret_ext.so
|
52
52
|
- ext/dummy.exe
|
53
|
+
- ext/segment_term_enum.c
|
54
|
+
- ext/terminfo.c
|
55
|
+
- ext/term_infos_reader.c
|
56
|
+
- ext/ferret_ext.so
|
57
|
+
- ext/similarity.c
|
53
58
|
- lib/ferret.rb
|
54
59
|
- lib/ferret/analysis.rb
|
55
60
|
- lib/ferret/document.rb
|