websolr-rails 1.4.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -10
- data/LICENSE +17 -16
- data/README.rdoc +16 -62
- data/Rakefile +2 -60
- data/VERSION +1 -1
- data/lib/websolr-rails.rb +54 -1
- data/lib/websolr.rb +2 -1
- metadata +12 -215
- data/CHANGELOG +0 -8
- data/TESTING_THE_PLUGIN +0 -25
- data/bin/websolr +0 -10
- data/config/solr.yml +0 -15
- data/config/solr_environment.rb +0 -22
- data/generate_rdoc.sh +0 -13
- data/lib/acts_as_solr.rb +0 -65
- data/lib/acts_methods.rb +0 -281
- data/lib/class_methods.rb +0 -243
- data/lib/common_methods.rb +0 -89
- data/lib/deprecation.rb +0 -61
- data/lib/instance_methods.rb +0 -181
- data/lib/lazy_document.rb +0 -18
- data/lib/parser_methods.rb +0 -230
- data/lib/search_results.rb +0 -72
- data/lib/solr.rb +0 -21
- data/lib/solr/connection.rb +0 -190
- data/lib/solr/document.rb +0 -78
- data/lib/solr/exception.rb +0 -13
- data/lib/solr/field.rb +0 -39
- data/lib/solr/importer.rb +0 -19
- data/lib/solr/importer/array_mapper.rb +0 -26
- data/lib/solr/importer/delimited_file_source.rb +0 -38
- data/lib/solr/importer/hpricot_mapper.rb +0 -27
- data/lib/solr/importer/mapper.rb +0 -51
- data/lib/solr/importer/solr_source.rb +0 -43
- data/lib/solr/importer/xpath_mapper.rb +0 -35
- data/lib/solr/indexer.rb +0 -52
- data/lib/solr/request.rb +0 -26
- data/lib/solr/request/add_document.rb +0 -63
- data/lib/solr/request/base.rb +0 -36
- data/lib/solr/request/commit.rb +0 -31
- data/lib/solr/request/delete.rb +0 -50
- data/lib/solr/request/dismax.rb +0 -46
- data/lib/solr/request/index_info.rb +0 -22
- data/lib/solr/request/modify_document.rb +0 -51
- data/lib/solr/request/optimize.rb +0 -21
- data/lib/solr/request/ping.rb +0 -36
- data/lib/solr/request/select.rb +0 -56
- data/lib/solr/request/spellcheck.rb +0 -30
- data/lib/solr/request/standard.rb +0 -402
- data/lib/solr/request/update.rb +0 -23
- data/lib/solr/response.rb +0 -27
- data/lib/solr/response/add_document.rb +0 -17
- data/lib/solr/response/base.rb +0 -42
- data/lib/solr/response/commit.rb +0 -17
- data/lib/solr/response/delete.rb +0 -13
- data/lib/solr/response/dismax.rb +0 -8
- data/lib/solr/response/index_info.rb +0 -26
- data/lib/solr/response/modify_document.rb +0 -17
- data/lib/solr/response/optimize.rb +0 -14
- data/lib/solr/response/ping.rb +0 -28
- data/lib/solr/response/ruby.rb +0 -42
- data/lib/solr/response/select.rb +0 -17
- data/lib/solr/response/spellcheck.rb +0 -20
- data/lib/solr/response/standard.rb +0 -64
- data/lib/solr/response/xml.rb +0 -42
- data/lib/solr/solrtasks.rb +0 -27
- data/lib/solr/util.rb +0 -32
- data/lib/solr/xml.rb +0 -44
- data/lib/solr_fixtures.rb +0 -13
- data/lib/tasks/database.rake +0 -18
- data/lib/tasks/solr.rake +0 -94
- data/lib/tasks/test.rake +0 -7
- data/lib/websolr_controller.rb +0 -233
- data/lib/websolr_option_parser.rb +0 -61
- data/lib/websolr_rails.rb +0 -1
- data/lib/websolr_rails/tasks.rb +0 -4
- data/lib/will_paginate_support.rb +0 -12
- data/solr/CHANGES.txt +0 -1207
- data/solr/LICENSE.txt +0 -712
- data/solr/NOTICE.txt +0 -90
- data/solr/etc/jetty.xml +0 -205
- data/solr/etc/webdefault.xml +0 -379
- data/solr/lib/easymock.jar +0 -0
- data/solr/lib/jetty-6.1.3.jar +0 -0
- data/solr/lib/jetty-util-6.1.3.jar +0 -0
- data/solr/lib/jsp-2.1/ant-1.6.5.jar +0 -0
- data/solr/lib/jsp-2.1/core-3.1.1.jar +0 -0
- data/solr/lib/jsp-2.1/jsp-2.1.jar +0 -0
- data/solr/lib/jsp-2.1/jsp-api-2.1.jar +0 -0
- data/solr/lib/servlet-api-2.4.jar +0 -0
- data/solr/lib/servlet-api-2.5-6.1.3.jar +0 -0
- data/solr/lib/xpp3-1.1.3.4.O.jar +0 -0
- data/solr/logs/.empty-dir-for-git +0 -0
- data/solr/solr/README.txt +0 -52
- data/solr/solr/bin/abc +0 -176
- data/solr/solr/bin/abo +0 -176
- data/solr/solr/bin/backup +0 -108
- data/solr/solr/bin/backupcleaner +0 -142
- data/solr/solr/bin/commit +0 -128
- data/solr/solr/bin/optimize +0 -129
- data/solr/solr/bin/readercycle +0 -129
- data/solr/solr/bin/rsyncd-disable +0 -77
- data/solr/solr/bin/rsyncd-enable +0 -76
- data/solr/solr/bin/rsyncd-start +0 -145
- data/solr/solr/bin/rsyncd-stop +0 -105
- data/solr/solr/bin/scripts-util +0 -83
- data/solr/solr/bin/snapcleaner +0 -148
- data/solr/solr/bin/snapinstaller +0 -168
- data/solr/solr/bin/snappuller +0 -248
- data/solr/solr/bin/snappuller-disable +0 -77
- data/solr/solr/bin/snappuller-enable +0 -77
- data/solr/solr/bin/snapshooter +0 -109
- data/solr/solr/conf/admin-extra.html +0 -31
- data/solr/solr/conf/protwords.txt +0 -21
- data/solr/solr/conf/schema.xml +0 -126
- data/solr/solr/conf/scripts.conf +0 -24
- data/solr/solr/conf/solrconfig.xml +0 -458
- data/solr/solr/conf/stopwords.txt +0 -57
- data/solr/solr/conf/synonyms.txt +0 -31
- data/solr/solr/conf/xslt/example.xsl +0 -132
- data/solr/solr/conf/xslt/example_atom.xsl +0 -63
- data/solr/solr/conf/xslt/example_rss.xsl +0 -62
- data/solr/start.jar +0 -0
- data/solr/tmp/.empty-dir-for-git +0 -0
- data/solr/webapps/solr.war +0 -0
- data/test/config/solr.yml +0 -2
- data/test/db/connections/mysql/connection.rb +0 -10
- data/test/db/connections/sqlite/connection.rb +0 -8
- data/test/db/migrate/001_create_books.rb +0 -15
- data/test/db/migrate/002_create_movies.rb +0 -12
- data/test/db/migrate/003_create_categories.rb +0 -11
- data/test/db/migrate/004_create_electronics.rb +0 -16
- data/test/db/migrate/005_create_authors.rb +0 -12
- data/test/db/migrate/006_create_postings.rb +0 -9
- data/test/db/migrate/007_create_posts.rb +0 -13
- data/test/db/migrate/008_create_gadgets.rb +0 -11
- data/test/fixtures/authors.yml +0 -9
- data/test/fixtures/books.yml +0 -13
- data/test/fixtures/categories.yml +0 -7
- data/test/fixtures/db_definitions/mysql.sql +0 -41
- data/test/fixtures/electronics.yml +0 -49
- data/test/fixtures/movies.yml +0 -9
- data/test/fixtures/postings.yml +0 -10
- data/test/functional/acts_as_solr_test.rb +0 -413
- data/test/functional/association_indexing_test.rb +0 -37
- data/test/functional/faceted_search_test.rb +0 -163
- data/test/functional/multi_solr_search_test.rb +0 -51
- data/test/models/author.rb +0 -10
- data/test/models/book.rb +0 -10
- data/test/models/category.rb +0 -8
- data/test/models/electronic.rb +0 -21
- data/test/models/gadget.rb +0 -9
- data/test/models/movie.rb +0 -17
- data/test/models/novel.rb +0 -2
- data/test/models/post.rb +0 -3
- data/test/models/posting.rb +0 -11
- data/test/test_helper.rb +0 -51
- data/test/unit/acts_methods_shoulda.rb +0 -70
- data/test/unit/class_methods_shoulda.rb +0 -88
- data/test/unit/common_methods_shoulda.rb +0 -112
- data/test/unit/instance_methods_shoulda.rb +0 -326
- data/test/unit/lazy_document_shoulda.rb +0 -35
- data/test/unit/parser_instance.rb +0 -19
- data/test/unit/parser_methods_shoulda.rb +0 -278
- data/test/unit/solr_instance.rb +0 -46
- data/test/unit/test_helper.rb +0 -14
- data/websolr-rails.gemspec +0 -243
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'lazy_document'
|
3
|
-
|
4
|
-
class UserModel; end
|
5
|
-
|
6
|
-
class LazyDocumentTest < Test::Unit::TestCase
|
7
|
-
context "With a lazy document" do
|
8
|
-
setup do
|
9
|
-
@record = stub(:record)
|
10
|
-
@record.stubs(:is_valid?).returns true
|
11
|
-
UserModel.stubs(:find).returns @record
|
12
|
-
@document = ActsAsSolr::LazyDocument.new(1, UserModel)
|
13
|
-
end
|
14
|
-
|
15
|
-
context "with an uninitialized document" do
|
16
|
-
should "fetch the record from the database" do
|
17
|
-
UserModel.expects(:find).with(1).returns(@record)
|
18
|
-
@document.is_valid?
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
context "with an initialized document" do
|
23
|
-
should "not fetch the record again" do
|
24
|
-
@document.is_valid?
|
25
|
-
@document.expects(:find).never
|
26
|
-
@document.is_valid?
|
27
|
-
end
|
28
|
-
|
29
|
-
should "reroute the calls to the record" do
|
30
|
-
@record.expects(:is_valid?).once
|
31
|
-
@document.is_valid?
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
class ActsAsSolr::ParserInstance
|
2
|
-
include ActsAsSolr::ParserMethods
|
3
|
-
include ActsAsSolr::CommonMethods
|
4
|
-
attr_accessor :configuration, :solr_configuration
|
5
|
-
|
6
|
-
def table_name
|
7
|
-
"documents"
|
8
|
-
end
|
9
|
-
|
10
|
-
def primary_key
|
11
|
-
"id"
|
12
|
-
end
|
13
|
-
|
14
|
-
def find(*args)
|
15
|
-
[]
|
16
|
-
end
|
17
|
-
|
18
|
-
public :parse_results, :reorder, :parse_query, :add_scores, :replace_types
|
19
|
-
end
|
@@ -1,278 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/test_helper'
|
2
|
-
require 'parser_methods'
|
3
|
-
require 'common_methods'
|
4
|
-
require 'search_results'
|
5
|
-
require 'deprecation'
|
6
|
-
module Solr; module Request; end; end
|
7
|
-
require 'solr/request/base'
|
8
|
-
require 'solr/request/select'
|
9
|
-
require 'solr/request/standard'
|
10
|
-
require 'parser_instance'
|
11
|
-
require 'lazy_document'
|
12
|
-
|
13
|
-
class ActsAsSolr::Post; end
|
14
|
-
|
15
|
-
class ParserMethodsTest < Test::Unit::TestCase
|
16
|
-
|
17
|
-
context "With a parser instance" do
|
18
|
-
setup do
|
19
|
-
@parser = ActsAsSolr::ParserInstance.new
|
20
|
-
end
|
21
|
-
|
22
|
-
context "When parsing results" do
|
23
|
-
setup do
|
24
|
-
@results = stub(:results)
|
25
|
-
@results.stubs(:total_hits).returns(2)
|
26
|
-
@results.stubs(:hits).returns([])
|
27
|
-
@results.stubs(:max_score).returns 2.1
|
28
|
-
@results.stubs(:data).returns({"responseHeader" => {"QTime" => "10.2"}})
|
29
|
-
end
|
30
|
-
|
31
|
-
should "return a SearchResults object" do
|
32
|
-
assert_equal ActsAsSolr::SearchResults, @parser.parse_results(@results).class
|
33
|
-
end
|
34
|
-
|
35
|
-
should "set the max score" do
|
36
|
-
assert_equal 2.1, @parser.parse_results(@results).max_score
|
37
|
-
end
|
38
|
-
|
39
|
-
should "include the facets" do
|
40
|
-
@results.stubs(:data).returns({"responseHeader" => {"QTime" => "10.2"}, "facet_counts" => 2})
|
41
|
-
assert_equal 2, @parser.parse_results(@results, :facets => true).facets
|
42
|
-
end
|
43
|
-
|
44
|
-
context "when the format requests objects" do
|
45
|
-
setup do
|
46
|
-
@parser.configuration = {:format => :objects}
|
47
|
-
@parser.solr_configuration = {:primary_key_field => :pk_id}
|
48
|
-
@results.stubs(:hits).returns [{"pk_id" => 1}, {"pk_id" => 2}]
|
49
|
-
@parser.stubs(:reorder)
|
50
|
-
end
|
51
|
-
|
52
|
-
should "query with the record ids" do
|
53
|
-
@parser.expects(:find).with(:all, :conditions => ["documents.id in (?)", [1, 2]]).returns [1, 2]
|
54
|
-
@parser.parse_results(@results)
|
55
|
-
end
|
56
|
-
|
57
|
-
should "reorder the records" do
|
58
|
-
@parser.expects(:reorder).with([], [1, 2])
|
59
|
-
@parser.parse_results(@results)
|
60
|
-
end
|
61
|
-
|
62
|
-
should "add :include if :include was specified" do
|
63
|
-
@parser.expects(:find).with(:all, :conditions => ["documents.id in (?)", [1, 2]], :include => [:author]).returns [1, 2]
|
64
|
-
@parser.parse_results(@results, :include => [:author])
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
context "when the format doesn't request objects" do
|
69
|
-
setup do
|
70
|
-
@parser.solr_configuration = {:primary_key_field => "pk_id"}
|
71
|
-
end
|
72
|
-
|
73
|
-
should "not query the database" do
|
74
|
-
@parser.expects(:find).never
|
75
|
-
@parser.parse_results(@results, :format => nil)
|
76
|
-
end
|
77
|
-
|
78
|
-
should "return just the ids" do
|
79
|
-
@results.stubs(:hits).returns([{"pk_id" => 1}, {"pk_id" => 2}])
|
80
|
-
assert_equal [1, 2], @parser.parse_results(@results, :format => nil).docs
|
81
|
-
end
|
82
|
-
|
83
|
-
should "ignore the :lazy option" do
|
84
|
-
@results.stubs(:hits).returns([{"pk_id" => 1}, {"pk_id" => 2}])
|
85
|
-
assert_equal [1, 2], @parser.parse_results(@results, :format => :ids, :lazy => true).docs
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
context "with an empty result set" do
|
90
|
-
setup do
|
91
|
-
@results.stubs(:total_hits).returns(0)
|
92
|
-
@results.stubs(:hits).returns([])
|
93
|
-
end
|
94
|
-
|
95
|
-
should "return an empty search results set" do
|
96
|
-
assert_equal 0, @parser.parse_results(@results).total
|
97
|
-
end
|
98
|
-
|
99
|
-
should "not have any search results" do
|
100
|
-
assert_equal [], @parser.parse_results(@results).docs
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
context "with a nil result set" do
|
105
|
-
should "return an empty search results set" do
|
106
|
-
assert_equal 0, @parser.parse_results(nil).total
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
context "with the scores option" do
|
111
|
-
should "add the scores" do
|
112
|
-
@parser.expects(:add_scores).with([], @results)
|
113
|
-
@parser.parse_results(@results, :scores => true)
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
context "with lazy format" do
|
118
|
-
setup do
|
119
|
-
@parser.solr_configuration = {:primary_key_field => :pk_id}
|
120
|
-
@results.stubs(:hits).returns([{"pk_id" => 1}, {"pk_id" => 2}])
|
121
|
-
end
|
122
|
-
|
123
|
-
should "create LazyDocuments for the resulting docs" do
|
124
|
-
result = @parser.parse_results(@results, :lazy => true)
|
125
|
-
assert_equal ActsAsSolr::LazyDocument, result.results.first.class
|
126
|
-
end
|
127
|
-
|
128
|
-
should "set the document id as the record id" do
|
129
|
-
result = @parser.parse_results(@results, :lazy => true)
|
130
|
-
assert_equal 1, result.results.first.id
|
131
|
-
end
|
132
|
-
|
133
|
-
should "set the document class" do
|
134
|
-
result = @parser.parse_results(@results, :lazy => true)
|
135
|
-
assert_equal ActsAsSolr::ParserInstance, result.results.first.clazz.class
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
end
|
140
|
-
|
141
|
-
context "when reordering results" do
|
142
|
-
should "raise an error if arguments don't have the same number of elements" do
|
143
|
-
assert_raise(RuntimeError) {@parser.reorder([], [1])}
|
144
|
-
end
|
145
|
-
|
146
|
-
should "reorder the results to match the order of the documents returned by solr" do
|
147
|
-
thing1 = stub(:thing1)
|
148
|
-
thing1.stubs(:id).returns 5
|
149
|
-
thing2 = stub(:thing2)
|
150
|
-
thing2.stubs(:id).returns 1
|
151
|
-
thing3 = stub(:things3)
|
152
|
-
thing3.stubs(:id).returns 3
|
153
|
-
things = [thing1, thing2, thing3]
|
154
|
-
reordered = @parser.reorder(things, [1, 3, 5])
|
155
|
-
assert_equal [1, 3, 5], reordered.collect{|thing| thing.id}
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
context "When parsing a query" do
|
160
|
-
setup do
|
161
|
-
ActsAsSolr::Post.stubs(:execute)
|
162
|
-
@parser.stubs(:solr_type_condition).returns "(type:ParserMethodsTest)"
|
163
|
-
@parser.solr_configuration = {:primary_key_field => "id"}
|
164
|
-
@parser.configuration = {:solr_fields => nil}
|
165
|
-
end
|
166
|
-
|
167
|
-
should "set the limit and offset" do
|
168
|
-
ActsAsSolr::Post.expects(:execute).with {|request|
|
169
|
-
10 == request.to_hash[:rows]
|
170
|
-
20 == request.to_hash[:start]
|
171
|
-
}
|
172
|
-
@parser.parse_query "foo", :limit => 10, :offset => 20
|
173
|
-
end
|
174
|
-
|
175
|
-
should "set the operator" do
|
176
|
-
ActsAsSolr::Post.expects(:execute).with {|request|
|
177
|
-
"OR" == request.to_hash["q.op"]
|
178
|
-
}
|
179
|
-
@parser.parse_query "foo", :operator => :or
|
180
|
-
end
|
181
|
-
|
182
|
-
should "not execute anything if the query is nil" do
|
183
|
-
ActsAsSolr::Post.expects(:execute).never
|
184
|
-
assert_nil @parser.parse_query(nil)
|
185
|
-
end
|
186
|
-
|
187
|
-
should "not execute anything if the query is ''" do
|
188
|
-
ActsAsSolr::Post.expects(:execute).never
|
189
|
-
assert_nil @parser.parse_query('')
|
190
|
-
end
|
191
|
-
|
192
|
-
should "raise an error if invalid options where specified" do
|
193
|
-
assert_raise(RuntimeError) {@parser.parse_query "foo", :invalid => true}
|
194
|
-
end
|
195
|
-
|
196
|
-
should "add the type" do
|
197
|
-
ActsAsSolr::Post.expects(:execute).with {|request|
|
198
|
-
request.to_hash[:q].include?("(type:ParserMethodsTest)")
|
199
|
-
}
|
200
|
-
@parser.parse_query "foo"
|
201
|
-
end
|
202
|
-
|
203
|
-
should "append the field types for the specified fields" do
|
204
|
-
ActsAsSolr::Post.expects(:execute).with {|request|
|
205
|
-
request.to_hash[:q].include?("(username_t:Chunky)")
|
206
|
-
}
|
207
|
-
@parser.parse_query "username:Chunky"
|
208
|
-
end
|
209
|
-
|
210
|
-
should "replace the field types" do
|
211
|
-
@parser.expects(:replace_types).returns(["active_i:1"])
|
212
|
-
ActsAsSolr::Post.expects(:execute).with {|request|
|
213
|
-
request.to_hash[:q].include?("active_i:1")
|
214
|
-
}
|
215
|
-
@parser.parse_query "active:1"
|
216
|
-
end
|
217
|
-
|
218
|
-
should "add score and primary key to field list" do
|
219
|
-
ActsAsSolr::Post.expects(:execute).with {|request|
|
220
|
-
request.to_hash[:fl] == ('id,score')
|
221
|
-
}
|
222
|
-
@parser.parse_query "foo"
|
223
|
-
end
|
224
|
-
|
225
|
-
context "with the order option" do
|
226
|
-
should "add the order criteria to the query" do
|
227
|
-
ActsAsSolr::Post.expects(:execute).with {|request|
|
228
|
-
request.to_hash[:q].include?(";active_t desc")
|
229
|
-
}
|
230
|
-
@parser.parse_query "active:1", :order => "active desc"
|
231
|
-
end
|
232
|
-
end
|
233
|
-
|
234
|
-
context "with facets" do
|
235
|
-
end
|
236
|
-
end
|
237
|
-
|
238
|
-
context "When setting the field types" do
|
239
|
-
setup do
|
240
|
-
@parser.configuration = {:solr_fields => {:name => {:type => :string},
|
241
|
-
:age => {:type => :integer}}}
|
242
|
-
end
|
243
|
-
|
244
|
-
should "replace the _t suffix with the real type" do
|
245
|
-
assert_equal ["name_s:Chunky AND age_i:21"], @parser.replace_types(["name_t:Chunky AND age_t:21"])
|
246
|
-
end
|
247
|
-
|
248
|
-
context "with a suffix" do
|
249
|
-
should "not include the colon when false" do
|
250
|
-
assert_equal ["name_s"], @parser.replace_types(["name_t"], false)
|
251
|
-
end
|
252
|
-
|
253
|
-
should "include the colon by default" do
|
254
|
-
assert_equal ["name_s:Chunky"], @parser.replace_types(["name_t:Chunky"])
|
255
|
-
end
|
256
|
-
end
|
257
|
-
end
|
258
|
-
|
259
|
-
context "When adding scores" do
|
260
|
-
setup do
|
261
|
-
@solr_data = stub(:results)
|
262
|
-
@solr_data.stubs(:total_hits).returns(1)
|
263
|
-
@solr_data.stubs(:hits).returns([{"id" => 2, "score" => 2.546}])
|
264
|
-
@solr_data.stubs(:max_score).returns 2.1
|
265
|
-
|
266
|
-
@results = [Array.new]
|
267
|
-
|
268
|
-
@parser.stubs(:record_id).returns(2)
|
269
|
-
|
270
|
-
@parser.solr_configuration = {:primary_key_field => "id"}
|
271
|
-
end
|
272
|
-
|
273
|
-
should "add the score to the result document" do
|
274
|
-
assert_equal 2.546, @parser.add_scores(@results, @solr_data).first.last.solr_score
|
275
|
-
end
|
276
|
-
end
|
277
|
-
end
|
278
|
-
end
|
data/test/unit/solr_instance.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'instance_methods'
|
2
|
-
|
3
|
-
class SolrInstance
|
4
|
-
include ActsAsSolr::InstanceMethods
|
5
|
-
attr_accessor :configuration, :solr_configuration, :name
|
6
|
-
|
7
|
-
def initialize(name = "Chunky bacon!")
|
8
|
-
@name = name
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.primary_key
|
12
|
-
"id"
|
13
|
-
end
|
14
|
-
|
15
|
-
def logger
|
16
|
-
@logger ||= Logger.new(StringIO.new)
|
17
|
-
end
|
18
|
-
|
19
|
-
def record_id(obj)
|
20
|
-
10
|
21
|
-
end
|
22
|
-
|
23
|
-
def boost_rate
|
24
|
-
10.0
|
25
|
-
end
|
26
|
-
|
27
|
-
def irate
|
28
|
-
8.0
|
29
|
-
end
|
30
|
-
|
31
|
-
def name_for_solr
|
32
|
-
name
|
33
|
-
end
|
34
|
-
|
35
|
-
def id_for_solr
|
36
|
-
"bogus"
|
37
|
-
end
|
38
|
-
|
39
|
-
def type_for_solr
|
40
|
-
"humbug"
|
41
|
-
end
|
42
|
-
|
43
|
-
def get_solr_field_type(args)
|
44
|
-
"s"
|
45
|
-
end
|
46
|
-
end
|
data/test/unit/test_helper.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
$:.unshift(File.join(File.expand_path(File.dirname(__FILE__)), "..", "..", "lib"))
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'test/unit'
|
5
|
-
|
6
|
-
if RUBY_VERSION =~ /^1\.9/
|
7
|
-
puts "\nRunning the unit test suite doesn't as of yet work with Ruby 1.9, because Mocha hasn't yet been updated to use minitest."
|
8
|
-
puts
|
9
|
-
exit 1
|
10
|
-
end
|
11
|
-
|
12
|
-
require 'mocha'
|
13
|
-
gem 'thoughtbot-shoulda'
|
14
|
-
require 'shoulda'
|
data/websolr-rails.gemspec
DELETED
@@ -1,243 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{websolr-rails}
|
8
|
-
s.version = "1.4.4"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Kyle Maxwell"]
|
12
|
-
s.date = %q{2009-10-11}
|
13
|
-
s.default_executable = %q{websolr}
|
14
|
-
s.description = %q{acts_as_solr compatible gem for websolr}
|
15
|
-
s.email = %q{kyle@kylemaxwell.com}
|
16
|
-
s.executables = ["websolr"]
|
17
|
-
s.extra_rdoc_files = [
|
18
|
-
"LICENSE",
|
19
|
-
"README.rdoc"
|
20
|
-
]
|
21
|
-
s.files = [
|
22
|
-
".document",
|
23
|
-
".gitignore",
|
24
|
-
"CHANGELOG",
|
25
|
-
"LICENSE",
|
26
|
-
"README.rdoc",
|
27
|
-
"Rakefile",
|
28
|
-
"TESTING_THE_PLUGIN",
|
29
|
-
"VERSION",
|
30
|
-
"bin/websolr",
|
31
|
-
"config/solr.yml",
|
32
|
-
"config/solr_environment.rb",
|
33
|
-
"generate_rdoc.sh",
|
34
|
-
"lib/acts_as_solr.rb",
|
35
|
-
"lib/acts_methods.rb",
|
36
|
-
"lib/class_methods.rb",
|
37
|
-
"lib/common_methods.rb",
|
38
|
-
"lib/deprecation.rb",
|
39
|
-
"lib/instance_methods.rb",
|
40
|
-
"lib/lazy_document.rb",
|
41
|
-
"lib/parser_methods.rb",
|
42
|
-
"lib/search_results.rb",
|
43
|
-
"lib/solr.rb",
|
44
|
-
"lib/solr/connection.rb",
|
45
|
-
"lib/solr/document.rb",
|
46
|
-
"lib/solr/exception.rb",
|
47
|
-
"lib/solr/field.rb",
|
48
|
-
"lib/solr/importer.rb",
|
49
|
-
"lib/solr/importer/array_mapper.rb",
|
50
|
-
"lib/solr/importer/delimited_file_source.rb",
|
51
|
-
"lib/solr/importer/hpricot_mapper.rb",
|
52
|
-
"lib/solr/importer/mapper.rb",
|
53
|
-
"lib/solr/importer/solr_source.rb",
|
54
|
-
"lib/solr/importer/xpath_mapper.rb",
|
55
|
-
"lib/solr/indexer.rb",
|
56
|
-
"lib/solr/request.rb",
|
57
|
-
"lib/solr/request/add_document.rb",
|
58
|
-
"lib/solr/request/base.rb",
|
59
|
-
"lib/solr/request/commit.rb",
|
60
|
-
"lib/solr/request/delete.rb",
|
61
|
-
"lib/solr/request/dismax.rb",
|
62
|
-
"lib/solr/request/index_info.rb",
|
63
|
-
"lib/solr/request/modify_document.rb",
|
64
|
-
"lib/solr/request/optimize.rb",
|
65
|
-
"lib/solr/request/ping.rb",
|
66
|
-
"lib/solr/request/select.rb",
|
67
|
-
"lib/solr/request/spellcheck.rb",
|
68
|
-
"lib/solr/request/standard.rb",
|
69
|
-
"lib/solr/request/update.rb",
|
70
|
-
"lib/solr/response.rb",
|
71
|
-
"lib/solr/response/add_document.rb",
|
72
|
-
"lib/solr/response/base.rb",
|
73
|
-
"lib/solr/response/commit.rb",
|
74
|
-
"lib/solr/response/delete.rb",
|
75
|
-
"lib/solr/response/dismax.rb",
|
76
|
-
"lib/solr/response/index_info.rb",
|
77
|
-
"lib/solr/response/modify_document.rb",
|
78
|
-
"lib/solr/response/optimize.rb",
|
79
|
-
"lib/solr/response/ping.rb",
|
80
|
-
"lib/solr/response/ruby.rb",
|
81
|
-
"lib/solr/response/select.rb",
|
82
|
-
"lib/solr/response/spellcheck.rb",
|
83
|
-
"lib/solr/response/standard.rb",
|
84
|
-
"lib/solr/response/xml.rb",
|
85
|
-
"lib/solr/solrtasks.rb",
|
86
|
-
"lib/solr/util.rb",
|
87
|
-
"lib/solr/xml.rb",
|
88
|
-
"lib/solr_fixtures.rb",
|
89
|
-
"lib/tasks/database.rake",
|
90
|
-
"lib/tasks/solr.rake",
|
91
|
-
"lib/tasks/test.rake",
|
92
|
-
"lib/websolr-rails.rb",
|
93
|
-
"lib/websolr.rb",
|
94
|
-
"lib/websolr_controller.rb",
|
95
|
-
"lib/websolr_option_parser.rb",
|
96
|
-
"lib/websolr_rails.rb",
|
97
|
-
"lib/websolr_rails/tasks.rb",
|
98
|
-
"lib/will_paginate_support.rb",
|
99
|
-
"solr/CHANGES.txt",
|
100
|
-
"solr/LICENSE.txt",
|
101
|
-
"solr/NOTICE.txt",
|
102
|
-
"solr/etc/jetty.xml",
|
103
|
-
"solr/etc/webdefault.xml",
|
104
|
-
"solr/lib/easymock.jar",
|
105
|
-
"solr/lib/jetty-6.1.3.jar",
|
106
|
-
"solr/lib/jetty-util-6.1.3.jar",
|
107
|
-
"solr/lib/jsp-2.1/ant-1.6.5.jar",
|
108
|
-
"solr/lib/jsp-2.1/core-3.1.1.jar",
|
109
|
-
"solr/lib/jsp-2.1/jsp-2.1.jar",
|
110
|
-
"solr/lib/jsp-2.1/jsp-api-2.1.jar",
|
111
|
-
"solr/lib/servlet-api-2.4.jar",
|
112
|
-
"solr/lib/servlet-api-2.5-6.1.3.jar",
|
113
|
-
"solr/lib/xpp3-1.1.3.4.O.jar",
|
114
|
-
"solr/logs/.empty-dir-for-git",
|
115
|
-
"solr/solr/README.txt",
|
116
|
-
"solr/solr/bin/abc",
|
117
|
-
"solr/solr/bin/abo",
|
118
|
-
"solr/solr/bin/backup",
|
119
|
-
"solr/solr/bin/backupcleaner",
|
120
|
-
"solr/solr/bin/commit",
|
121
|
-
"solr/solr/bin/optimize",
|
122
|
-
"solr/solr/bin/readercycle",
|
123
|
-
"solr/solr/bin/rsyncd-disable",
|
124
|
-
"solr/solr/bin/rsyncd-enable",
|
125
|
-
"solr/solr/bin/rsyncd-start",
|
126
|
-
"solr/solr/bin/rsyncd-stop",
|
127
|
-
"solr/solr/bin/scripts-util",
|
128
|
-
"solr/solr/bin/snapcleaner",
|
129
|
-
"solr/solr/bin/snapinstaller",
|
130
|
-
"solr/solr/bin/snappuller",
|
131
|
-
"solr/solr/bin/snappuller-disable",
|
132
|
-
"solr/solr/bin/snappuller-enable",
|
133
|
-
"solr/solr/bin/snapshooter",
|
134
|
-
"solr/solr/conf/admin-extra.html",
|
135
|
-
"solr/solr/conf/protwords.txt",
|
136
|
-
"solr/solr/conf/schema.xml",
|
137
|
-
"solr/solr/conf/scripts.conf",
|
138
|
-
"solr/solr/conf/solrconfig.xml",
|
139
|
-
"solr/solr/conf/stopwords.txt",
|
140
|
-
"solr/solr/conf/synonyms.txt",
|
141
|
-
"solr/solr/conf/xslt/example.xsl",
|
142
|
-
"solr/solr/conf/xslt/example_atom.xsl",
|
143
|
-
"solr/solr/conf/xslt/example_rss.xsl",
|
144
|
-
"solr/start.jar",
|
145
|
-
"solr/tmp/.empty-dir-for-git",
|
146
|
-
"solr/webapps/solr.war",
|
147
|
-
"test/config/solr.yml",
|
148
|
-
"test/db/connections/mysql/connection.rb",
|
149
|
-
"test/db/connections/sqlite/connection.rb",
|
150
|
-
"test/db/migrate/001_create_books.rb",
|
151
|
-
"test/db/migrate/002_create_movies.rb",
|
152
|
-
"test/db/migrate/003_create_categories.rb",
|
153
|
-
"test/db/migrate/004_create_electronics.rb",
|
154
|
-
"test/db/migrate/005_create_authors.rb",
|
155
|
-
"test/db/migrate/006_create_postings.rb",
|
156
|
-
"test/db/migrate/007_create_posts.rb",
|
157
|
-
"test/db/migrate/008_create_gadgets.rb",
|
158
|
-
"test/fixtures/authors.yml",
|
159
|
-
"test/fixtures/books.yml",
|
160
|
-
"test/fixtures/categories.yml",
|
161
|
-
"test/fixtures/db_definitions/mysql.sql",
|
162
|
-
"test/fixtures/electronics.yml",
|
163
|
-
"test/fixtures/movies.yml",
|
164
|
-
"test/fixtures/postings.yml",
|
165
|
-
"test/functional/acts_as_solr_test.rb",
|
166
|
-
"test/functional/association_indexing_test.rb",
|
167
|
-
"test/functional/faceted_search_test.rb",
|
168
|
-
"test/functional/multi_solr_search_test.rb",
|
169
|
-
"test/models/author.rb",
|
170
|
-
"test/models/book.rb",
|
171
|
-
"test/models/category.rb",
|
172
|
-
"test/models/electronic.rb",
|
173
|
-
"test/models/gadget.rb",
|
174
|
-
"test/models/movie.rb",
|
175
|
-
"test/models/novel.rb",
|
176
|
-
"test/models/post.rb",
|
177
|
-
"test/models/posting.rb",
|
178
|
-
"test/test_helper.rb",
|
179
|
-
"test/unit/acts_methods_shoulda.rb",
|
180
|
-
"test/unit/class_methods_shoulda.rb",
|
181
|
-
"test/unit/common_methods_shoulda.rb",
|
182
|
-
"test/unit/instance_methods_shoulda.rb",
|
183
|
-
"test/unit/lazy_document_shoulda.rb",
|
184
|
-
"test/unit/parser_instance.rb",
|
185
|
-
"test/unit/parser_methods_shoulda.rb",
|
186
|
-
"test/unit/solr_instance.rb",
|
187
|
-
"test/unit/test_helper.rb",
|
188
|
-
"websolr-rails.gemspec"
|
189
|
-
]
|
190
|
-
s.homepage = %q{http://github.com/onemorecloud/websolr-rails}
|
191
|
-
s.rdoc_options = ["--main", "README.rdoc", "README.rdoc", "lib"]
|
192
|
-
s.require_paths = ["lib"]
|
193
|
-
s.rubygems_version = %q{1.3.4}
|
194
|
-
s.summary = %q{acts_as_solr compatible gem for websolr}
|
195
|
-
s.test_files = [
|
196
|
-
"test/db/connections/mysql/connection.rb",
|
197
|
-
"test/db/connections/sqlite/connection.rb",
|
198
|
-
"test/db/migrate/001_create_books.rb",
|
199
|
-
"test/db/migrate/002_create_movies.rb",
|
200
|
-
"test/db/migrate/003_create_categories.rb",
|
201
|
-
"test/db/migrate/004_create_electronics.rb",
|
202
|
-
"test/db/migrate/005_create_authors.rb",
|
203
|
-
"test/db/migrate/006_create_postings.rb",
|
204
|
-
"test/db/migrate/007_create_posts.rb",
|
205
|
-
"test/db/migrate/008_create_gadgets.rb",
|
206
|
-
"test/functional/acts_as_solr_test.rb",
|
207
|
-
"test/functional/association_indexing_test.rb",
|
208
|
-
"test/functional/faceted_search_test.rb",
|
209
|
-
"test/functional/multi_solr_search_test.rb",
|
210
|
-
"test/models/author.rb",
|
211
|
-
"test/models/book.rb",
|
212
|
-
"test/models/category.rb",
|
213
|
-
"test/models/electronic.rb",
|
214
|
-
"test/models/gadget.rb",
|
215
|
-
"test/models/movie.rb",
|
216
|
-
"test/models/novel.rb",
|
217
|
-
"test/models/post.rb",
|
218
|
-
"test/models/posting.rb",
|
219
|
-
"test/test_helper.rb",
|
220
|
-
"test/unit/acts_methods_shoulda.rb",
|
221
|
-
"test/unit/class_methods_shoulda.rb",
|
222
|
-
"test/unit/common_methods_shoulda.rb",
|
223
|
-
"test/unit/instance_methods_shoulda.rb",
|
224
|
-
"test/unit/lazy_document_shoulda.rb",
|
225
|
-
"test/unit/parser_instance.rb",
|
226
|
-
"test/unit/parser_methods_shoulda.rb",
|
227
|
-
"test/unit/solr_instance.rb",
|
228
|
-
"test/unit/test_helper.rb"
|
229
|
-
]
|
230
|
-
|
231
|
-
if s.respond_to? :specification_version then
|
232
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
233
|
-
s.specification_version = 3
|
234
|
-
|
235
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
236
|
-
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
237
|
-
else
|
238
|
-
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
239
|
-
end
|
240
|
-
else
|
241
|
-
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
242
|
-
end
|
243
|
-
end
|