class Seasy::Index

Attributes

name[RW]

Public Class Methods

default() click to toggle source
# File lib/seasy/index.rb, line 29
def Index::default
  @@defaultee = Index.new if not defined? @@defaultee
end
new(name = 'default') click to toggle source
# File lib/seasy/index.rb, line 23
def initialize name = 'default'
  @name = name
  @storage = Configuration.instance.storage.new
  @storage.name = name if @storage.respond_to? :name=
end
with_name(name) click to toggle source
# File lib/seasy/index.rb, line 33
def Index::with_name name
  stringed_name = name.to_s
  @@indices = {} if not defined? @@indices
  if @@indices[stringed_name].nil?
    @@indices[stringed_name] = Index.new stringed_name
  end
  @@indices[stringed_name]
end

Public Instance Methods

add(searchee, target, options = {}) click to toggle source
# File lib/seasy/index.rb, line 42
def add searchee, target, options = {}
  options[:source] = target if options[:source].nil?
  save target, fragmentize( searchee ), options
end
clear() click to toggle source
# File lib/seasy/index.rb, line 51
def clear
  @storage.clear
end
remove(target) click to toggle source
# File lib/seasy/index.rb, line 55
def remove target
  @storage.remove target
end

Private Instance Methods

fragmentize(searchee) click to toggle source
# File lib/seasy/index.rb, line 61
def fragmentize searchee
   f = Fragmentizer.new
   f.fragmentize searchee
end
save(target, weights, options) click to toggle source
# File lib/seasy/index.rb, line 66
def save target, weights, options
  @storage.save target, weights, options
end