Project

xapor

0.0
No commit activity in last 3 years
No release in over 3 years
Rails plugin for Xapian search, built on XapianFu and DelayedJob.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.2.9

Runtime

>= 1.1.0
>= 0
 Project Readme

Xapor

Description

Pronounced ‘zap-or’. A Xapian rails plugin, designed to integrate XapianFu into ActiveRecord in a nicer,
simpler fashion.

Usage

To add an index to a model, simply add a block like the following:

class SomeModel < ActiveRecord::Base
  xapor do |idx|
    idx.search :name
    idx.search :description
  end
end

This will create an in-memory index for the model. It will also automatically index all the items currently in the
table and add and remove items from the index as they are created, updated and removed.

Once you have added xapor to a model, you can then search it by doing:

SomeModel.search("Some search query")

This returns a XapianFu result set, which can be easily turned into AR models with a block like the following:

results = []
SomeModel.search("Text").each do |result|
  results << SomeModel.find(result.id)
end

TODO

  • Get the indexing working with disk-based Xapian indexes
  • Sort out the ability to store and retrieve extra item data in the index and remove the need to load data from the database on every search
  • Add the ability to put in a ‘xapor.yml’ config file to define environment specific index settings (e.g. use memory in testing, and a different directory prefix in dev and prod)

Copyright

Copyright © 2010 Hedtek Ltd. See LICENSE for details.