Class: RediSearcher::Document
- Inherits:
-
Client::CommandBase
- Object
- Client::CommandBase
- RediSearcher::Document
- Defined in:
- lib/redi_searcher/document.rb
Constant Summary collapse
- OPTIONS_FLAGS =
{ add: [:nosave, :replace, :partial], del: [:dd] }
- OPTIONS_PARAMS =
{ add: [:language, :payload], }
Instance Attribute Summary collapse
-
#doc_id ⇒ Object
readonly
Returns the value of attribute doc_id.
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Instance Method Summary collapse
- #add(**options) ⇒ Object
- #del(**options) ⇒ Object
-
#initialize(index, doc_id, weight = nil, **fields) ⇒ Document
constructor
A new instance of Document.
Constructor Details
#initialize(index, doc_id, weight = nil, **fields) ⇒ Document
Returns a new instance of Document.
14 15 16 17 18 19 |
# File 'lib/redi_searcher/document.rb', line 14 def initialize(index, doc_id, weight = nil, **fields) @index = index @doc_id = doc_id @fields = filter_by_schema(fields) @weight = weight || RediSearcher::DEFAULT_WEIGHT end |
Instance Attribute Details
#doc_id ⇒ Object (readonly)
Returns the value of attribute doc_id.
12 13 14 |
# File 'lib/redi_searcher/document.rb', line 12 def doc_id @doc_id end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
12 13 14 |
# File 'lib/redi_searcher/document.rb', line 12 def fields @fields end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
12 13 14 |
# File 'lib/redi_searcher/document.rb', line 12 def index @index end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
12 13 14 |
# File 'lib/redi_searcher/document.rb', line 12 def weight @weight end |
Instance Method Details
#add(**options) ⇒ Object
21 22 23 |
# File 'lib/redi_searcher/document.rb', line 21 def add(**) index.client.call(ft_add()) end |
#del(**options) ⇒ Object
25 26 27 |
# File 'lib/redi_searcher/document.rb', line 25 def del(**) index.client.call(ft_del()) end |