Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rubygems'
- require 'ferret'
- system("rm -rf /tmp/index; mkdir -p /tmp/index")
- index = Ferret::Index::Index.new(:path => PATH, :key => :id, :auto_flush => false)
- 100.times do |i|
- doc = {}
- doc[:id] = i
- index << doc
- end
- index.flush
- result = index.search('id:*')
- puts "Total hits = #{result.total_hits}"
- 100.times do |i|
- doc = {}
- doc[:id] = i + 100
- index << doc
- end
- index.flush
- result = index.search('id:*')
- puts "Total hits = #{result.total_hits}"
Add Comment
Please, Sign In to add comment