lib/tasks/try.rake in picky-0.11.2 vs lib/tasks/try.rake in picky-0.12.0

- old
+ new

@@ -1,14 +1,14 @@ # Tasks for manually testing your engine configuration. # namespace :try do - # 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 + # desc "Try how a given word would be tokenized when indexing (type:category optional)." + task :index, [:text, :index_and_category] => :application do |_, options| + text, index_and_category = options.text, options.index_and_category - tokenizer = type_and_field ? Indexes.find(*type_and_field.split(':')).tokenizer : Tokenizers::Index.default + tokenizer = index_and_category ? Indexes.find(*index_and_category.split(':')).tokenizer : Tokenizers::Index.default puts "\"#{text}\" is index tokenized as #{tokenizer.tokenize(text.dup).to_a}" end # desc "Try how a given word would be tokenized when querying." @@ -16,14 +16,14 @@ text = options.text puts "\"#{text}\" is query tokenized as #{Tokenizers::Query.default.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 + # desc "Try the given text with both the index and the query (type:category optional)." + task :both, [:text, :index_and_category] => :application do |_, options| + text, index_and_category = options.text, options.index_and_category - Rake::Task[:"try:index"].invoke text, type_and_field + Rake::Task[:"try:index"].invoke text, index_and_category Rake::Task[:"try:query"].invoke text end end \ No newline at end of file