class MetasploitDataModels::Search::Operator::Multitext

Searches multiple text fields by breaking up the formatted value into words and doing text search for each word across each operator named in {#operator_names}.

Attributes

name[RW]

@!attribute name

The name of this operator.

@return [Symbol]
operator_names[W]

@!attribute #operator_names

The name of the operators to search across.

@return [Array<Symbol>]

Public Instance Methods

children(formatted_value) click to toggle source

Breaks `formatted_value` into words using `Shellwords.split`. Each word is then searched across all {#operators}, where any operator can match for that word. The search for multiple multiple is intersected, so that additional words can refine the search.

@param formatted_value [#to_s] @return [Array<Metasploit::Model::Search::Operation::Group::Union>] Unions to be intersected.

# File app/models/metasploit_data_models/search/operator/multitext.rb, line 43
def children(formatted_value)
  words = Shellwords.split formatted_value.to_s

  words.map { |word|
    child_operators = operators.map { |operator|
      operator.operate_on(word)
    }

    Metasploit::Model::Search::Operation::Group::Union.new(
        children: child_operators,
        operator: self
    )
  }
end
operator_names() click to toggle source

The name of the operators to search for each word.

@return [Array<Symbol>] Default to `[]`

# File app/models/metasploit_data_models/search/operator/multitext.rb, line 61
def operator_names
  @operator_names ||= []
end
operators() click to toggle source

Operators with {#operator_names}.

@return [Array<Metasploit::Model::Search::Operator::Base>]

# File app/models/metasploit_data_models/search/operator/multitext.rb, line 68
def operators
  @operators ||= operator_names.map { |operator_name|
    operator(operator_name)
  }
end