johnl / xapian-fu
- Source
- Commits
- Network (1)
- Issues (1)
- Downloads (4)
- Wiki (1)
- Graphs
-
Tag:
release-0.2
| name | age | message | |
|---|---|---|---|
| |
LICENSE | ||
| |
README.rdoc | ||
| |
examples/ | ||
| |
lib/ | ||
| |
spec/ | ||
| |
xapian-fu.gemspec |
README.rdoc
Xapian Fu
XapianFu is a Ruby library for working with Xapian databases. It builds on the GPL licensed Xapian Ruby bindings but provides an interface more in-line with "The Ruby Way"(tm).
Example
Create a database, add 3 documents to it and then search and retrieve them.
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.search("mountain").each do |match|
puts match.fields[:title]
end
ActiveRecord Example
You could use it with something like ActiveRecord to index database records:
db = XapianDb.new(:dir => 'posts.db', :create => true,
:store => :id)
Post.all.each { db << p.attributes }
db.search("custard").collect do |doc|
Post.find(doc.id)
end
More Info
| Author: | John Leach (john@johnleach.co.uk) |
| Copyright: | Copyright © 2009 John Leach |
| License: | GPL v2 |
| Github: | github.com/johnl/xapian-fu/tree/master |


