Changeset 152
- Timestamp:
- 02/09/07 20:51:34 (2 years ago)
- Files:
-
- trunk/demo/test/unit/content_test.rb (modified) (2 diffs)
- trunk/demo/test/unit/shared_index1_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/demo/test/unit/content_test.rb
r151 r152 208 208 qp = Ferret::QueryParser.new(:fields => ['title', 'content', 'description'], 209 209 :analyzer => Ferret::Analysis::WhiteSpaceAnalyzer.new) 210 # TODO '*' doesn't seem to work in 0.9 anymore - there's no .fields method211 # either :-(212 #qp.fields = i.reader.get_field_names.to_a213 #qp.fields = ['title','content']214 210 hits = i.search(qp.parse("title")) 215 211 assert_equal 2, hits.total_hits … … 232 228 hits.hits.each { |hit, score| count += 1 } 233 229 assert_equal 3, count 230 end 231 232 def test_find_rebuilds_index 233 remove_index Content 234 contents_from_ferret = Content.find_by_contents('description:title') 235 assert_equal 1, contents_from_ferret.size 236 end 237 238 def test_multi_search_rebuilds_index 239 remove_index Content 240 contents_from_ferret = Content.multi_search('description:title') 241 assert_equal 1, contents_from_ferret.size 242 end 243 244 def test_multi_index_rebuilds_index 245 remove_index Content 246 i = ActsAsFerret::MultiIndex.new([Content]) 247 assert File.exists?("#{Content.aaf_configuration[:index_dir]}/segments") 248 hits = i.search("description:title") 249 assert_equal 1, hits.total_hits, hits.inspect 250 end 251 252 def remove_index(clazz) 253 clazz.aaf_index.close # avoid io error when deleting the open index 254 FileUtils.rm_rf clazz.aaf_configuration[:index_dir] 255 assert !File.exists?("#{clazz.aaf_configuration[:index_dir]}/segments") 234 256 end 235 257 trunk/demo/test/unit/shared_index1_test.rb
r147 r152 28 28 end 29 29 30 def custom_query30 def test_custom_query 31 31 result = SharedIndex1.find_by_contents("name:first class_name:SharedIndex1") 32 32 assert_equal 1, result.size
