lib/picky/internals/indexers/serial.rb in picky-2.0.0.pre2 vs lib/picky/internals/indexers/serial.rb in picky-2.0.0.pre3
- old
+ new
@@ -1,35 +1,35 @@
# encoding: utf-8
#
module Indexers
-
+
# The indexer defines the control flow.
#
class Serial
-
+
attr_accessor :tokenizer, :source
-
+
def initialize configuration, source, tokenizer
@configuration = configuration
@source = source || raise_no_source
@tokenizer = tokenizer
end
-
+
# Raise a no source exception.
#
def raise_no_source
raise NoSourceSpecifiedException.new("No source given for #{@configuration}.")
end
-
+
# Delegates the key format to the source.
#
# Default is to_i.
#
def key_format
@source.key_format || :to_i
end
-
+
# Selects the original id (indexed id) and a column to process. The column data is called "token".
#
# Note: Puts together the parts first in an array, then releasing the array from time to time by joining.
#
def index
@@ -37,11 +37,11 @@
process
end
def process
comma = ?,
newline = ?\n
-
+
# TODO Move open to config?
#
# @category.prepared_index do |file|
# source.harvest(@index, @category) do |indexed_id, text|
# tokenizer.tokenize(text).each do |token_text|
@@ -65,8 +65,8 @@
end
end
def indexing_message
timed_exclaim %Q{"#{@configuration.identifier}": Starting indexing.}
end
-
+
end
end
\ No newline at end of file