Posted By: David Balmain
Date: 2005-10-22 09:49
Summary: Ferret 0.1.0
Project: ferret

Ferret 0.1.0 has been released. Ferret is a full port of the Java Lucene searching and indexing library. It's available as a gem so try it out! To get started quickly read the quick start at the project homepage;

http://ferret.davebalmain.com/trac/

Here's a very simple quick example;

require 'ferret'

include Ferret

docs = [
{ :title => "The Pragmatic Programmer",
:author => "Dave Thomas, Andy Hunt",
:tags => "Programming, Broken Windows, Boiled Frogs",
:published => "1999-10-13",
:content => "Yada yada yada ..."
},
{ :title => "Programming Ruby",
:author => "Dave Thomas, Chad Fowler, Andy Hunt",
:tags => "Ruby",
:published => "2004-10-06",
:content => "Yada yada yada ..."
},
{ :title => "Agile Web Development with Rails",
:author => "Dave Thomas, David Heinemeier Hansson, Leon Breedt, Mike Clark, Thomas Fuchs, Andreas Schwarz",
:tags => "Ruby, Rails, Web Development",
:published => "2005-07-13",
:content => "Yada yada yada ..."
},
{ :title => "Ruby, Developer's Guide",
:author => "Robert Feldt, Lyle Johnson, Michael Neumann",
:tags => "Ruby, Racc, GUI, FOX",
:published => "2002-10-06",
:content => "Yada yada yada ..."
},
{ :title => "Lucene In Action",
:author => "Otis Gospodnetic, Erik Hatcher",
:tags => "Lucene, Java, Search, Indexing",
:published => "2004-12-01",
:content => "Yada yada yada ..."
}
]

index = Index::Index.new()

docs.each {|doc| index << doc }

puts index.size

puts "\nFind all documents on ruby:-"
index.search_each("tags:Ruby") do |doc, score|
puts "Document <#{index[doc]["title"]}> found with a score of %0.2f" % score
end

puts "\nFind all documents on ruby published this year:-"
index.search_each("tags:ruby AND published: >= 2005") do |doc, score|
puts "Document <#{index[doc]["title"]}> found with a score of %0.2f" % score
end

puts "\nFind all documents by the Pragmatic Programmers:-"
index.search_each('author:("dave Thomas" AND "Andy hunt")') do |doc, score|
puts "Document <#{index[doc]["title"]}> found with a score of %0.2f" % score
end

Latest News
icalendar 1.4.0 Released
    Ryan Ahearn - 2013-05-21 23:17
BinData 1.5.0 - source moved to github
    Dion Mendel - 2013-05-21 11:10
v13.5.0 Released !!
    id 774 - 2013-05-18 12:28
Runt v0.9.0 Released
    Matthew Lipper - 2013-05-17 00:11
kramdown 1.0.2 released
    Thomas Leitner - 2013-05-09 06:58

 

Forums | Admin

Discussion Forums: ferret-0.1.0

Start New Thread Start New Thread

 

By: David Balmain
RE: This is great news! [ reply ]  
2005-10-23 23:51
I've looked into it. I can get much greater speed increase writing native C and I've already finished writing the indexer in C which is the main bottleneck. I just need to integrate it. ruby2c is an interesting project though.

By: Aslak Hellesøy
This is great news! [ reply ]  
2005-10-22 21:34
Have you considered using Ruby2C instead of writing native C?