lib/tasks/try.rake in picky-0.3.0 vs lib/tasks/try.rake in picky-0.9.0

- old
+ new

@@ -4,21 +4,23 @@ desc "Try how a given word would be tokenized when indexing (type:field optional)." task :index, [:text, :type_and_field] => :application do |_, options| text, type_and_field = options.text, options.type_and_field - tokenizer = type_and_field ? Indexes.find(*type_and_field.split(':')).tokenizer : Tokenizers::Index.new + tokenizer = type_and_field ? Indexes.find(*type_and_field.split(':')).tokenizer : Tokenizers::Default::Index puts "\"#{text}\" is index tokenized as #{tokenizer.tokenize(text).to_a}" end desc "Try how a given word would be tokenized when querying." task :query, [:text] => :application do |_, options| text = options.text # TODO tokenize destroys the original text... # - puts "\"#{text}\" is query tokenized as #{Tokenizers::Query.new.tokenize(text.dup).to_a.map(&:to_s)}" + # TODO Use the Query Tokenizer. + # + puts "\"#{text}\" is query tokenized as #{Tokenizers::Default::Query.tokenize(text.dup).to_a.map(&:to_s).map(&:to_sym)}" end desc "Try the given text with both the index and the query (type:field optional)." task :both, [:text, :type_and_field] => :application do |_, options| text, type_and_field = options.text, options.type_and_field \ No newline at end of file