Class: Picky::Query::Indexes::Check

Inherits:
Object
  • Object
show all
Defined in:
lib/picky/query/indexes/check.rb

Overview

Checks if multiple backends are used in the same search instance.

Using multiple backends for the same search are not yet possible.

Class Method Summary collapse

Class Method Details

.check_backends(indexes) ⇒ Object

Returns the right combinations strategy for a number of query indexes.

Currently it isn’t possible using Memory and Redis etc. indexes in the same query index group.

Picky will raise a Query::Indexes::DifferentBackendsError.



23
24
25
26
27
28
# File 'lib/picky/query/indexes/check.rb', line 23

def check_backends indexes
  backends = indexes.map &:backend
  backends.uniq! &:class
  raise_different backends if backends.size > 1
  backends
end

.raise_different(backends) ⇒ Object

Raises:



29
30
31
# File 'lib/picky/query/indexes/check.rb', line 29

def raise_different backends
  raise DifferentBackendsError.new(backends)
end