Skip to content

Commit

Permalink
ferret index demo
Browse files Browse the repository at this point in the history
  • Loading branch information
igrigorik committed May 2, 2009
1 parent 9e8c8d4 commit ae26b49
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions simple-ferret.rb
@@ -0,0 +1,17 @@
# Ilya Grigorik
#
# Ferret index demo
#

require 'ferret'
include Ferret

index = Index::Index.new()

index << {:title => "1", :content => "it is what it is"}
index << {:title => "2", :content => "what is it"}
index << {:title => "3", :content => "it is a banana"}

index.search_each('content:"banana"') do |id, score|
puts "Score: #{score}, #{index[id][:title]} "
end

0 comments on commit ae26b49

Please sign in to comment.