Class: Noiseless::Adapters::OpenSearch::RulesAPI
- Inherits:
-
Object
- Object
- Noiseless::Adapters::OpenSearch::RulesAPI
- Defined in:
- lib/noiseless/adapters/open_search.rb
Overview
Query Rules API for OpenSearch 3.x Rules allow pinning, boosting, or hiding specific results based on query patterns
Instance Method Summary collapse
-
#create(feature_type, rule_id, attributes:, feature_value:) ⇒ Object
(also: #put)
Create or update a rule.
-
#delete(feature_type, rule_id) ⇒ Object
Delete a rule.
-
#exists?(feature_type, rule_id) ⇒ Boolean
Check if a rule exists.
-
#get(feature_type, rule_id) ⇒ Object
Get a specific rule.
-
#initialize(adapter) ⇒ RulesAPI
constructor
A new instance of RulesAPI.
-
#list(feature_type, search_after: nil) ⇒ Object
(also: #all)
List rules for a feature type.
Constructor Details
#initialize(adapter) ⇒ RulesAPI
Returns a new instance of RulesAPI.
111 112 113 |
# File 'lib/noiseless/adapters/open_search.rb', line 111 def initialize(adapter) @adapter = adapter end |
Instance Method Details
#create(feature_type, rule_id, attributes:, feature_value:) ⇒ Object Also known as: put
Create or update a rule
120 121 122 123 124 125 126 |
# File 'lib/noiseless/adapters/open_search.rb', line 120 def create(feature_type, rule_id, attributes:, feature_value:) Sync do @adapter.send(:execute_create_rule, feature_type, rule_id, attributes: attributes, feature_value: feature_value) end end |
#delete(feature_type, rule_id) ⇒ Object
Delete a rule
147 148 149 150 151 |
# File 'lib/noiseless/adapters/open_search.rb', line 147 def delete(feature_type, rule_id) Sync do @adapter.send(:execute_delete_rule, feature_type, rule_id) end end |
#exists?(feature_type, rule_id) ⇒ Boolean
Check if a rule exists
154 155 156 157 158 |
# File 'lib/noiseless/adapters/open_search.rb', line 154 def exists?(feature_type, rule_id) Sync do @adapter.send(:execute_rule_exists?, feature_type, rule_id) end end |
#get(feature_type, rule_id) ⇒ Object
Get a specific rule
131 132 133 134 135 |
# File 'lib/noiseless/adapters/open_search.rb', line 131 def get(feature_type, rule_id) Sync do @adapter.send(:execute_get_rule, feature_type, rule_id) end end |
#list(feature_type, search_after: nil) ⇒ Object Also known as: all
List rules for a feature type
138 139 140 141 142 |
# File 'lib/noiseless/adapters/open_search.rb', line 138 def list(feature_type, search_after: nil) Sync do @adapter.send(:execute_list_rules, feature_type, search_after: search_after) end end |