Class: ElasticGraph::GraphQL::Filtering::BooleanQuery
- Inherits:
-
Object
- Object
- ElasticGraph::GraphQL::Filtering::BooleanQuery
- Defined in:
- lib/elastic_graph/graphql/filtering/boolean_query.rb
Overview
BooleanQuery is an internal class for composing a datastore query: www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html
It is composed of:
1) The occurrence type (:must, :filter, :should, or :must_not)
2) A list of query clauses evaluated by the given occurrence type
3) An optional flag indicating whether the occurrence should be negated
Constant Summary collapse
- ALWAYS_FALSE_FILTER =
: ::Array
filter({ids: {values: empty_array}})
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.filter(*clauses) ⇒ Object
24 25 26 |
# File 'lib/elastic_graph/graphql/filtering/boolean_query.rb', line 24 def self.filter(*clauses) new(:filter, clauses) end |
.must(*clauses) ⇒ Object
20 21 22 |
# File 'lib/elastic_graph/graphql/filtering/boolean_query.rb', line 20 def self.must(*clauses) new(:must, clauses) end |
.should(*clauses) ⇒ Object
28 29 30 |
# File 'lib/elastic_graph/graphql/filtering/boolean_query.rb', line 28 def self.should(*clauses) new(:should, clauses) end |
Instance Method Details
#merge_into(bool_node) ⇒ Object
32 33 34 |
# File 'lib/elastic_graph/graphql/filtering/boolean_query.rb', line 32 def merge_into(bool_node) bool_node[occurrence].concat(clauses) end |