Class: DataMapper::Adapters::Sphinx::Index

Inherits:
Object
  • Object
show all
Includes:
Assertions
Defined in:
lib/dm-sphinx-adapter/index.rb

Overview

Sphinx index definition.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model, name, options = {}) ⇒ Index

Parameters

model<DataMapper::Model>

Your resources model.

name<Symbol, String>

The index name.

options<Hash>

Optional arguments.

Options

:delta<Boolean>

Delta index. Delta indexes will be searched last when multiple indexes are defined for a resource. Default is false.



21
22
23
24
25
26
27
28
29
# File 'lib/dm-sphinx-adapter/index.rb', line 21

def initialize(model, name, options = {})
  assert_kind_of 'model',   model,   Model
  assert_kind_of 'name',    name,    Symbol, String
  assert_kind_of 'options', options, Hash

  @model = model
  @name  = name.to_sym
  @delta = options.fetch(:delta, false)
end

Instance Attribute Details

#modelObject (readonly)

Options.



10
11
12
# File 'lib/dm-sphinx-adapter/index.rb', line 10

def model
  @model
end

#nameObject (readonly)

Options.



10
11
12
# File 'lib/dm-sphinx-adapter/index.rb', line 10

def name
  @name
end

#optionsObject (readonly)

Options.



10
11
12
# File 'lib/dm-sphinx-adapter/index.rb', line 10

def options
  @options
end

Instance Method Details

#delta?Boolean

Is the index a delta index.

Returns:

  • (Boolean)


32
33
34
# File 'lib/dm-sphinx-adapter/index.rb', line 32

def delta?
  !!@delta
end