Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 17 lines (13 sloc) 0.371 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 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
Something went wrong with that request. Please try again.