redcar 0.9.1 → 0.9.2
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/CHANGES +6 -0
- data/Rakefile +1 -1
- data/lib/redcar.rb +2 -2
- data/lib/redcar/installer.rb +3 -2
- metadata +4 -62
- data/plugins/project_search/vendor/lucene/CHANGELOG +0 -147
- data/plugins/project_search/vendor/lucene/CONTRIBUTORS +0 -17
- data/plugins/project_search/vendor/lucene/Gemfile +0 -9
- data/plugins/project_search/vendor/lucene/Gemfile.lock +0 -33
- data/plugins/project_search/vendor/lucene/LICENSE +0 -19
- data/plugins/project_search/vendor/lucene/README.rdoc +0 -283
- data/plugins/project_search/vendor/lucene/Rakefile +0 -35
- data/plugins/project_search/vendor/lucene/examples/active_model/serializers.rb +0 -25
- data/plugins/project_search/vendor/lucene/examples/active_model/validation.rb +0 -26
- data/plugins/project_search/vendor/lucene/examples/admin/Rakefile +0 -4
- data/plugins/project_search/vendor/lucene/examples/admin/admin.rb +0 -29
- data/plugins/project_search/vendor/lucene/examples/admin/public/jquery.js +0 -4376
- data/plugins/project_search/vendor/lucene/examples/admin/public/neo4j.css +0 -153
- data/plugins/project_search/vendor/lucene/examples/admin/public/neo_admin.js +0 -18
- data/plugins/project_search/vendor/lucene/examples/admin/spec/admin_spec.rb +0 -26
- data/plugins/project_search/vendor/lucene/examples/admin/views/index.erb +0 -21
- data/plugins/project_search/vendor/lucene/examples/filetree/README.rdoc +0 -9
- data/plugins/project_search/vendor/lucene/examples/filetree/app.rb +0 -7
- data/plugins/project_search/vendor/lucene/examples/filetree/batch.props +0 -5
- data/plugins/project_search/vendor/lucene/examples/filetree/features/step_definitions/add_steps.rb +0 -121
- data/plugins/project_search/vendor/lucene/examples/filetree/features/support/env.rb +0 -30
- data/plugins/project_search/vendor/lucene/examples/filetree/features/support/rspec_helper.rb +0 -50
- data/plugins/project_search/vendor/lucene/examples/filetree/features/treesizes.feature +0 -19
- data/plugins/project_search/vendor/lucene/examples/imdb/1_create_neo_db.rb +0 -66
- data/plugins/project_search/vendor/lucene/examples/imdb/2_index_db.rb +0 -23
- data/plugins/project_search/vendor/lucene/examples/imdb/README +0 -12
- data/plugins/project_search/vendor/lucene/examples/imdb/find_actors.rb +0 -56
- data/plugins/project_search/vendor/lucene/examples/imdb/install.sh +0 -12
- data/plugins/project_search/vendor/lucene/examples/imdb/model.rb +0 -37
- data/plugins/project_search/vendor/lucene/examples/railway/README +0 -111
- data/plugins/project_search/vendor/lucene/examples/railway/railnet-app.rb +0 -31
- data/plugins/project_search/vendor/lucene/examples/railway/railnet-data.rb +0 -42
- data/plugins/project_search/vendor/lucene/examples/rest/example.rb +0 -41
- data/plugins/project_search/vendor/lucene/examples/you_might_know/YouMightKnow.java +0 -60
- data/plugins/project_search/vendor/lucene/examples/you_might_know/all_simple_paths.rb +0 -34
- data/plugins/project_search/vendor/lucene/examples/you_might_know/nodes.rb +0 -34
- data/plugins/project_search/vendor/lucene/examples/you_might_know/you_might_know.rb +0 -50
- data/plugins/project_search/vendor/lucene/lib/lucene.rb +0 -15
- data/plugins/project_search/vendor/lucene/lib/lucene/config.rb +0 -145
- data/plugins/project_search/vendor/lucene/lib/lucene/document.rb +0 -96
- data/plugins/project_search/vendor/lucene/lib/lucene/field_info.rb +0 -144
- data/plugins/project_search/vendor/lucene/lib/lucene/hits.rb +0 -54
- data/plugins/project_search/vendor/lucene/lib/lucene/index.rb +0 -267
- data/plugins/project_search/vendor/lucene/lib/lucene/index_info.rb +0 -146
- data/plugins/project_search/vendor/lucene/lib/lucene/index_searcher.rb +0 -157
- data/plugins/project_search/vendor/lucene/lib/lucene/jars.rb +0 -5
- data/plugins/project_search/vendor/lucene/lib/lucene/query_dsl.rb +0 -135
- data/plugins/project_search/vendor/lucene/lib/lucene/transaction.rb +0 -117
- data/plugins/project_search/vendor/lucene/lib/lucene/version.rb +0 -3
- data/plugins/project_search/vendor/lucene/lucene.gemspec +0 -23
- data/plugins/project_search/vendor/lucene/spec/lucene/document_spec.rb +0 -32
- data/plugins/project_search/vendor/lucene/spec/lucene/field_info_spec.rb +0 -70
- data/plugins/project_search/vendor/lucene/spec/lucene/index_info_spec.rb +0 -76
- data/plugins/project_search/vendor/lucene/spec/lucene/index_spec.rb +0 -643
- data/plugins/project_search/vendor/lucene/spec/lucene/query_dsl_spec.rb +0 -142
- data/plugins/project_search/vendor/lucene/spec/lucene/sort_spec.rb +0 -101
- data/plugins/project_search/vendor/lucene/spec/lucene/spec_helper.rb +0 -10
- data/plugins/project_search/vendor/lucene/spec/lucene/transaction_spec.rb +0 -118
@@ -1,142 +0,0 @@
|
|
1
|
-
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/../../lib")
|
2
|
-
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/..")
|
3
|
-
require 'lucene'
|
4
|
-
require 'lucene/spec_helper'
|
5
|
-
|
6
|
-
|
7
|
-
describe Lucene::QueryDSL, 'used from Index.find' do
|
8
|
-
|
9
|
-
before(:each) do
|
10
|
-
setup_lucene
|
11
|
-
@index = Index.new('my_index')
|
12
|
-
@index.field_infos[:value][:type] = Fixnum
|
13
|
-
@index << {:id => '42', :name => 'andreas', :foo => 'bar', :value => 1}
|
14
|
-
@index << {:id => '43', :name => 'andreas', :foo => 'baaz', :value => 2}
|
15
|
-
@index << {:id => '44', :name => 'x', :foo => 'bar', :value => 3}
|
16
|
-
@index << {:id => '45', :name => ['x','y','z']}
|
17
|
-
|
18
|
-
@doc1 = @index.uncommited['42']
|
19
|
-
@doc2 = @index.uncommited['43']
|
20
|
-
@doc3 = @index.uncommited['44']
|
21
|
-
@doc4 = @index.uncommited['45']
|
22
|
-
@index.commit
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should find a document using a simple dsl query" do
|
26
|
-
hits = @index.find { name == 'andreas'}
|
27
|
-
|
28
|
-
hits.size.should == 2
|
29
|
-
hits.should include(@doc1, @doc2)
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should find a document using a compound | expression" do
|
33
|
-
hits = @index.find { (name == 'andreas') | (name == 'x')}
|
34
|
-
hits.size.should == 4
|
35
|
-
hits.should include(@doc1, @doc2, @doc3, @doc4)
|
36
|
-
|
37
|
-
hits = @index.find { (name == 'andreasx') | (name == 'x')}
|
38
|
-
hits.size.should == 2
|
39
|
-
hits.should include(@doc3, @doc4)
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should find a document using a compound & expression with the same key" do
|
44
|
-
hits = @index.find { (name == 'y') & (name == 'x')}
|
45
|
-
hits.size.should == 1
|
46
|
-
hits.should include(@doc4)
|
47
|
-
|
48
|
-
hits = @index.find { (name == 'y') & (name == 'x') & (name == 'a')}
|
49
|
-
hits.size.should == 0
|
50
|
-
end
|
51
|
-
|
52
|
-
it "should find with Range" do
|
53
|
-
hits = @index.find { value == 2..9 }
|
54
|
-
hits.size.should == 2
|
55
|
-
hits.should include(@doc2, @doc3)
|
56
|
-
end
|
57
|
-
|
58
|
-
it "should find with Range in a compound expression " do
|
59
|
-
hits = @index.find { (name == 'andreas') & (value == 2..9) }
|
60
|
-
hits.size.should == 1
|
61
|
-
hits.should include(@doc2)
|
62
|
-
end
|
63
|
-
|
64
|
-
|
65
|
-
it "should find with a compound & expression" do
|
66
|
-
hits = @index.find { (name == 'andreas') & (foo == 'bar')}
|
67
|
-
|
68
|
-
hits.size.should == 1
|
69
|
-
hits.should include(@doc1)
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
|
-
describe Lucene::QueryDSL do
|
75
|
-
|
76
|
-
it "should parse & expressions" do
|
77
|
-
expr = Lucene::QueryDSL.parse{ (name == 'andreas') & (age == 30)}
|
78
|
-
expr.op.should == :&
|
79
|
-
expr.left.left.should == :name
|
80
|
-
expr.left.right.should == 'andreas'
|
81
|
-
|
82
|
-
expr.right.left.should == :age
|
83
|
-
expr.right.right.should == 30
|
84
|
-
end
|
85
|
-
|
86
|
-
it "should parse | expressions" do
|
87
|
-
expr = Lucene::QueryDSL.parse{ (name == 'andreas') | (age == 30)}
|
88
|
-
expr.op.should == :|
|
89
|
-
expr.left.left.should == :name
|
90
|
-
expr.left.right.should == 'andreas'
|
91
|
-
|
92
|
-
expr.right.left.should == :age
|
93
|
-
expr.right.right.should == 30
|
94
|
-
end
|
95
|
-
|
96
|
-
it "should parse range expressions" do
|
97
|
-
expr = Lucene::QueryDSL.parse{ name == 1..3}
|
98
|
-
|
99
|
-
expr.left.should == :name
|
100
|
-
expr.right.should be_kind_of(Range)
|
101
|
-
expr.right.first.should == 1
|
102
|
-
expr.right.last.should == 3
|
103
|
-
end
|
104
|
-
|
105
|
-
it "should generate a lucene query" do
|
106
|
-
expr = Lucene::QueryDSL.parse{ name == 'andreas' }
|
107
|
-
query = expr.to_lucene(Lucene::IndexInfo.new(:id))
|
108
|
-
query.should be_kind_of(Java::OrgApacheLuceneSearch::TermQuery)
|
109
|
-
term = query.getTerm
|
110
|
-
term.field.should == 'name'
|
111
|
-
term.text.should == 'andreas'
|
112
|
-
end
|
113
|
-
|
114
|
-
it "should know which fields are being used in a query" do
|
115
|
-
expr = Lucene::QueryDSL.parse{ name == 'andreas' }
|
116
|
-
expr._fields.should == [:name]
|
117
|
-
|
118
|
-
expr = Lucene::QueryDSL.parse{ (name == 'andreas') | (age == 1) }
|
119
|
-
expr._fields.should == [:name, :age]
|
120
|
-
end
|
121
|
-
|
122
|
-
|
123
|
-
it "should generate a lucene query" do
|
124
|
-
expr = Lucene::QueryDSL.parse{ (name == 'andreas') & (age == 1) }
|
125
|
-
query = expr.to_lucene(Lucene::IndexInfo.new(:id))
|
126
|
-
|
127
|
-
query.should be_kind_of(Java::OrgApacheLuceneSearch::BooleanQuery)
|
128
|
-
|
129
|
-
clauses = query.getClauses()
|
130
|
-
clauses.size.should == 2
|
131
|
-
|
132
|
-
term0 = clauses[0].getQuery.getTerm
|
133
|
-
term0.field.should == 'name'
|
134
|
-
term0.text.should == 'andreas'
|
135
|
-
|
136
|
-
term1 = clauses[1].getQuery.getTerm
|
137
|
-
term1.field.should == 'age'
|
138
|
-
term1.text.should == '1'
|
139
|
-
end
|
140
|
-
|
141
|
-
end
|
142
|
-
|
@@ -1,101 +0,0 @@
|
|
1
|
-
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/../../lib")
|
2
|
-
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/..")
|
3
|
-
require 'lucene'
|
4
|
-
require 'lucene/spec_helper'
|
5
|
-
|
6
|
-
describe "Index.find and sort" do
|
7
|
-
before(:all) do
|
8
|
-
setup_lucene
|
9
|
-
@index = Index.new('myindex')
|
10
|
-
@index.clear
|
11
|
-
@index << {:id => '1', :name => 'zzz', :category=>'abc', :group=>'z'}
|
12
|
-
@index << {:id => '2', :name => 'andreas', :category=>'abc',:group=>'z'}
|
13
|
-
@index << {:id => '3', :name => 'ted', :category=>'xyz',:group=>'z'}
|
14
|
-
@index << {:id => '4', :name => 'zoo', :category=>'abc',:group=>'z'}
|
15
|
-
@index << {:id => '5', :name => 'ted', :category=>'abc',:group=>'z'}
|
16
|
-
@index << {:id => '6', :name => 'ted', :category=>'zyx',:group=>'z'}
|
17
|
-
@index.commit
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should handle find and sort by name using Asc" do
|
21
|
-
r = @index.find(:group => 'z', :sort_by=>Asc[:name])
|
22
|
-
r.size.should == 6
|
23
|
-
r[0][:id].should == '2'
|
24
|
-
r[4][:id].should == '4'
|
25
|
-
r[5][:id].should == '1'
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should handle find and sort by name using Asc" do
|
29
|
-
r = @index.find(:group => 'z', :sort_by=>Desc[:name])
|
30
|
-
r.size.should == 6
|
31
|
-
r[0][:id].should == '1'
|
32
|
-
r[1][:id].should == '4'
|
33
|
-
r[5][:id].should == '2'
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should handle find and sort by name" do
|
37
|
-
r = @index.find(:group => 'z', :sort_by=>:name)
|
38
|
-
r.size.should == 6
|
39
|
-
r[0][:id].should == '2'
|
40
|
-
r[4][:id].should == '4'
|
41
|
-
r[5][:id].should == '1'
|
42
|
-
|
43
|
-
sort_category = r[1][:id] == '5' &&
|
44
|
-
r[2][:id] == '3' &&
|
45
|
-
r[3][:id] == '6'
|
46
|
-
sort_category.should == false
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should handle find and sort by name and category using Asc" do
|
50
|
-
r = @index.find(:group => 'z', :sort_by=>Asc[:name, :category])
|
51
|
-
r.size.should == 6
|
52
|
-
r[0][:id].should == '2'
|
53
|
-
r[4][:id].should == '4'
|
54
|
-
r[5][:id].should == '1'
|
55
|
-
r[1][:id].should == '5'
|
56
|
-
r[2][:id].should == '3'
|
57
|
-
r[3][:id].should == '6'
|
58
|
-
end
|
59
|
-
|
60
|
-
it "should handle find and sort by name and category using two Asc" do
|
61
|
-
r = @index.find(:group => 'z', :sort_by=>[Asc[:name], Asc[:category]])
|
62
|
-
r.size.should == 6
|
63
|
-
r[0][:id].should == '2'
|
64
|
-
r[4][:id].should == '4'
|
65
|
-
r[5][:id].should == '1'
|
66
|
-
r[1][:id].should == '5'
|
67
|
-
r[2][:id].should == '3'
|
68
|
-
r[3][:id].should == '6'
|
69
|
-
end
|
70
|
-
|
71
|
-
it "should handle find and sort by ASC name and DESC category" do
|
72
|
-
r = @index.find(:group => 'z', :sort_by=>[Asc[:name], Desc[:category]])
|
73
|
-
r.size.should == 6
|
74
|
-
r[0][:id].should == '2'
|
75
|
-
r[4][:id].should == '4'
|
76
|
-
r[5][:id].should == '1'
|
77
|
-
r[1][:id].should == '6'
|
78
|
-
r[2][:id].should == '3'
|
79
|
-
r[3][:id].should == '5'
|
80
|
-
end
|
81
|
-
|
82
|
-
it "should handle find and sort by name and category" do
|
83
|
-
r = @index.find(:group => 'z', :sort_by=>[:name,:category])
|
84
|
-
r.size.should == 6
|
85
|
-
r[0][:id].should == '2'
|
86
|
-
r[4][:id].should == '4'
|
87
|
-
r[5][:id].should == '1'
|
88
|
-
r[1][:id].should == '5'
|
89
|
-
r[2][:id].should == '3'
|
90
|
-
r[3][:id].should == '6'
|
91
|
-
end
|
92
|
-
|
93
|
-
it "should handle find with string and sort by name" do
|
94
|
-
r = @index.find("group:z", :sort_by=>:name)
|
95
|
-
r.size.should == 6
|
96
|
-
r[0][:id].should == '2'
|
97
|
-
r[4][:id].should == '4'
|
98
|
-
r[5][:id].should == '1'
|
99
|
-
end
|
100
|
-
|
101
|
-
end
|
@@ -1,118 +0,0 @@
|
|
1
|
-
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/../../lib")
|
2
|
-
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/..")
|
3
|
-
require 'lucene'
|
4
|
-
require 'lucene/spec_helper'
|
5
|
-
|
6
|
-
|
7
|
-
describe Lucene::Transaction do
|
8
|
-
|
9
|
-
before(:each) do
|
10
|
-
setup_lucene
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should have a to_s method" do
|
14
|
-
t = Lucene::Transaction.new
|
15
|
-
t.to_s.should match(/Transaction \[commited=false, rollback=false, indexes=0, object_id=/)
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should reuse Index instance in the same transaction" do
|
19
|
-
# given
|
20
|
-
index = nil
|
21
|
-
Lucene::Transaction.run do
|
22
|
-
index1 = Index.new('var/index/foo')
|
23
|
-
index2 = Index.new('var/index/foo')
|
24
|
-
index1.object_id.should == index2.object_id
|
25
|
-
end # when it commits&
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should create a new instance of Index if running in a new transaction" do
|
29
|
-
# given
|
30
|
-
index1 = nil
|
31
|
-
index2 = nil
|
32
|
-
Lucene::Transaction.run do
|
33
|
-
index1 = Index.new('var/index/foo')
|
34
|
-
end
|
35
|
-
|
36
|
-
Lucene::Transaction.run do
|
37
|
-
index2 = Index.new('var/index/foo')
|
38
|
-
end
|
39
|
-
|
40
|
-
index1.object_id.should_not == index2.object_id
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should update all indexes when it commits" do
|
44
|
-
# given
|
45
|
-
index = nil
|
46
|
-
Lucene::Transaction.run do
|
47
|
-
index = Index.new('var/index/foo')
|
48
|
-
index << {:id => '1', :name => 'andreas'}
|
49
|
-
end # when it commits&
|
50
|
-
|
51
|
-
# then
|
52
|
-
result = index.find('name' => 'andreas')
|
53
|
-
result.size.should == 1
|
54
|
-
result[0][:id].should == '1'
|
55
|
-
end
|
56
|
-
|
57
|
-
it "should not index docuements when transaction has rolled back" do
|
58
|
-
# given
|
59
|
-
index = nil
|
60
|
-
Lucene::Transaction.run do |t|
|
61
|
-
index = Index.new('var/index/foo')
|
62
|
-
index << {:id => '1', :name => 'andreas'}
|
63
|
-
t.failure
|
64
|
-
end # when it commits
|
65
|
-
|
66
|
-
# then
|
67
|
-
result = index.find('name' => 'andreas')
|
68
|
-
result.size.should == 0
|
69
|
-
end
|
70
|
-
|
71
|
-
|
72
|
-
it "should not find uncommited documents for a different thread" do
|
73
|
-
# given
|
74
|
-
t1 = Thread.start do
|
75
|
-
Lucene::Transaction.new
|
76
|
-
index = Index.new('var/index/foo')
|
77
|
-
index << {:id => '1', :name => 'andreas'}
|
78
|
-
index = Index.new('var/index/foo')
|
79
|
-
index.uncommited['1'].should_not be_nil
|
80
|
-
end
|
81
|
-
|
82
|
-
t1.join
|
83
|
-
index = Index.new('var/index/foo')
|
84
|
-
index.uncommited['1'].should be_nil
|
85
|
-
end
|
86
|
-
|
87
|
-
it "should update an index from several threads" do
|
88
|
-
threads = []
|
89
|
-
for i in 1..10 do
|
90
|
-
for k in 1..5 do
|
91
|
-
threads << Thread.start(i,k) do |ii,kk|
|
92
|
-
Lucene::Transaction.run do |t|
|
93
|
-
index = Index.new('var/index/foo')
|
94
|
-
id = (ii*10 + kk).to_s
|
95
|
-
value = "thread#{ii}#{kk}"
|
96
|
-
index << {:id => id, :name => value}
|
97
|
-
end # when it commits&
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
|
103
|
-
threads.each {|t| t.join}
|
104
|
-
|
105
|
-
# make sure we can find those
|
106
|
-
index = Index.new 'var/index/foo'
|
107
|
-
for i in 1..10 do
|
108
|
-
for k in 1..5 do
|
109
|
-
value = "thread#{i}#{k}"
|
110
|
-
result = index.find(:name => value)
|
111
|
-
result.size.should == 1
|
112
|
-
result[0][:id].should == (i*10 +k).to_s
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
end
|
118
|
-
|