Project

seasy

0.0
No commit activity in last 3 years
No release in over 3 years
An easy to use search index (requiring no external servers) with a pluggable design for index storage.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0.0
~> 1.6.4
>= 0
>= 2.5.0
 Project Readme

seasy

Seasy is a library that makes search easy.

Usage

# updating the index
index = Index::default
index.add 'Fredrik Rubenssons blog', 'http://www.highlevelbits.com'

# searching the index
index.search "Ruben" # will return {'http://www.highlevelbits.com' => 1}

Configuration

Seasy got a built-in memory storage that is used default. If you need to do something else it can be configured:

include Seasy
configure do |config|
  config.storage = YourOwnFancyStorage
end

A storage needs to answer to the following methods.

  • an empty constructor
  • a save method with three arguments: a target, a string that will be indexed and a options hash
  • a search method that accepts a query string
  • a remove method that accepts a source that is to be removed (see below for source and target definitions)
  • a clear method for test purposes

If several indices will be used the storage needs to support a name= method that sets the name of the index. There will be one or moer instances of the storage per index.

The storage also needs to understand the difference between targets and sources. A target is where you want to end when doing a search. A source is the item that contains the text that leads to the source. (Example ffrom whan I needed it: you have a database of persons with payments and want to search for persons based on details in the payments but when a payment is removed those search items should be removed but not the persons own search items.) To enable this the save method accepts source in the options hash and the remove method should remove all items matching the argument source.

Copyright

Copyright (c) 2011-2012 Fredrik Rubensson. See LICENSE.txt for further details.