Quantcast
Channel: Brightbox Ruby Blog » search
Viewing all articles
Browse latest Browse all 2

Full Text Indexing in Ruby with Xapian Fu

0
0

I’ve just properly announced my Ruby full text indexing library, Xapian Fu, on my personal blog.  It’s a Ruby interface to Xapian, an open source search engine Library.  Xapian Fu basically gives you a Hash interface to Xapian – so you get a persistent Hash with full text indexing built in.

For example:

  require 'xapian-fu'
  include XapianFu
  db = XapianDb.new(:dir => 'example.db', :create => true,
                    :store => [:title, :year])
  db << { :title => 'Brokeback Mountain', :year => 2005 }
  db << { :title => 'Cold Mountain', :year => 2004 }
  db << { :title => 'Yes Man', :year => 2008 }
  db.flush
  db.search("mountain").each do |match|
    puts match.values[:title]
  end

The full announcement is here, github project here and rdoc here.  Hope you find it useful!


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images