Class: Arelastic::Queries::Regexp

Inherits:
Query show all
Defined in:
lib/arelastic/queries/regexp.rb

Overview

Implements support for the Regexp filter.

Does not support Ruby ‘Regexp` objects, because Elasticsearch’s regular expression syntax only supports a subset of the operators usually implemented in a fully-featured regex engine.

Reference: www.elastic.co/guide/en/elasticsearch/reference/1.7/query-dsl-regexp-filter.html

Instance Method Summary collapse

Methods inherited from Query

#negate, #nested

Methods inherited from Nodes::Node

#==, #convert_to_elastic, #read_option!

Methods included from Arities::Binary

#binary

Methods included from Arities::Polyadic

#polyadic

Methods included from Arities::Unary

#unary

Constructor Details

#initialize(field, value, options = {}) ⇒ Regexp

Returns a new instance of Regexp.



15
16
17
18
19
20
21
# File 'lib/arelastic/queries/regexp.rb', line 15

def initialize(field, value, options = {})
  if value.is_a?(::Regexp)
    raise TypeError.new('Regexp objects are not allowed to be Regexp filter values')
  end

  super
end