Class: StrokeDB::InvertedListIndex
- Defined in:
- lib/strokedb/stores/inverted_list_file_storage.rb
Instance Attribute Summary collapse
-
#document_store ⇒ Object
Returns the value of attribute document_store.
-
#storage ⇒ Object
Returns the value of attribute storage.
Instance Method Summary collapse
- #delete(doc) ⇒ Object
- #find(*args) ⇒ Object
- #find_uuids(*args) ⇒ Object
-
#initialize(storage) ⇒ InvertedListIndex
constructor
A new instance of InvertedListIndex.
- #insert(doc) ⇒ Object
- #save! ⇒ Object
Constructor Details
#initialize(storage) ⇒ InvertedListIndex
Returns a new instance of InvertedListIndex.
61 62 63 64 |
# File 'lib/strokedb/stores/inverted_list_file_storage.rb', line 61 def initialize(storage) @storage = storage @list = nil end |
Instance Attribute Details
#document_store ⇒ Object
Returns the value of attribute document_store.
60 61 62 |
# File 'lib/strokedb/stores/inverted_list_file_storage.rb', line 60 def document_store @document_store end |
#storage ⇒ Object
Returns the value of attribute storage.
60 61 62 |
# File 'lib/strokedb/stores/inverted_list_file_storage.rb', line 60 def storage @storage end |
Instance Method Details
#delete(doc) ⇒ Object
82 83 84 85 86 |
# File 'lib/strokedb/stores/inverted_list_file_storage.rb', line 82 def delete(doc) slots = indexable_slots_for_doc(doc) q = PointQuery.new(slots) list.delete(q.slots, doc.uuid) end |
#find(*args) ⇒ Object
70 71 72 73 74 |
# File 'lib/strokedb/stores/inverted_list_file_storage.rb', line 70 def find(*args) find_uuids(*args).map do |uuid| @document_store.find(uuid) end end |
#find_uuids(*args) ⇒ Object
66 67 68 |
# File 'lib/strokedb/stores/inverted_list_file_storage.rb', line 66 def find_uuids(*args) list.find(*args) end |
#insert(doc) ⇒ Object
76 77 78 79 80 |
# File 'lib/strokedb/stores/inverted_list_file_storage.rb', line 76 def insert(doc) slots = indexable_slots_for_doc(doc) q = PointQuery.new(slots) list.insert(q.slots, doc.uuid) end |
#save! ⇒ Object
88 89 90 |
# File 'lib/strokedb/stores/inverted_list_file_storage.rb', line 88 def save! @storage.save!(list) end |