Class: MetasploitDataModels::Search::Operator::Multitext
- Inherits:
-
Metasploit::Model::Search::Operator::Group::Intersection
- Object
- Metasploit::Model::Search::Operator::Group::Intersection
- MetasploitDataModels::Search::Operator::Multitext
- Defined in:
- app/models/metasploit_data_models/search/operator/multitext.rb
Overview
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.
Instance Attribute Summary collapse
-
#name ⇒ Symbol
The name of this operator.
-
#operator_names ⇒ Array<Symbol>
The name of the operators to search for each word.
Instance Method Summary collapse
-
#children(formatted_value) ⇒ Array<Metasploit::Model::Search::Operation::Group::Union>
Breaks
formatted_value
into words usingShellwords.split
. -
#operators ⇒ Array<Metasploit::Model::Search::Operator::Base>
Operators with #operator_names.
Instance Attribute Details
#name ⇒ Symbol
The name of this operator.
14 15 16 |
# File 'app/models/metasploit_data_models/search/operator/multitext.rb', line 14 def name @name end |
#operator_names ⇒ Array<Symbol>
The name of the operators to search for each word.
20 |
# File 'app/models/metasploit_data_models/search/operator/multitext.rb', line 20 attr_writer :operator_names |
Instance Method Details
#children(formatted_value) ⇒ Array<Metasploit::Model::Search::Operation::Group::Union>
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.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# 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 |
#operators ⇒ Array<Metasploit::Model::Search::Operator::Base>
Operators with #operator_names.
68 69 70 71 72 |
# File 'app/models/metasploit_data_models/search/operator/multitext.rb', line 68 def operators @operators ||= operator_names.map { |operator_name| operator(operator_name) } end |