lib/picky/sources/db.rb in picky-2.6.0 vs lib/picky/sources/db.rb in picky-2.7.0
- old
+ new
@@ -83,12 +83,10 @@
# Take a snapshot of the data.
#
# Uses CREATE TABLE AS with the given SELECT statement to create a snapshot of the data.
#
def take_snapshot index
- connect_backend
-
origin = snapshot_table_name index.name
on_database = database.connection
# Drop the table if it exists.
#
@@ -108,12 +106,10 @@
end
# Counts all the entries that are used for the index.
#
def count index_name
- connect_backend
-
database.connection.select_value("SELECT COUNT(#{@@traversal_id}) FROM #{snapshot_table_name(index_name)}").to_i
end
# The name of the snapshot table created by Picky.
#
@@ -122,20 +118,17 @@
end
# Harvests the data to index in chunks.
#
def harvest category, &block
- connect_backend
-
(0..count(category.index_name)).step(chunksize) do |offset|
get_data category, offset, &block
end
end
# Gets the data from the backend.
#
def get_data category, offset, &block # :nodoc:
-
select_statement = harvest_statement_with_offset category, offset
# TODO Rewrite ASAP.
#
if database.connection.adapter_name == "PostgreSQL"
\ No newline at end of file