Sha256: be22a0fa26280c2250a591b3c7dd077501e2d9463943e40173aa8945291fcbfc

Contents?: true

Size: 910 Bytes

Versions: 1

Compression:

Stored size: 910 Bytes

Contents

# Tasks for manually testing your engine configuration.
#
desc "Try the given text in the indexer/query (index and category optional)."
task :try, [:text, :index, :category] => :application do |_, options|
  text, index, category = options.text, options.index, options.category

  puts
  fail "\x1b[31mrake try needs a text to try indexing and query preparation\x1b[m, e.g. rake 'try[yourtext]'." unless text

  specific = Picky::Indexes
  specific = specific[index]    if index
  specific = specific[category] if category

  puts "\"#{text}\" is saved in the #{specific.identifier} index as #{specific.tokenizer.tokenize(text.dup).to_a}"

  puts "\"#{text}\" as a search will be tokenized into #{Picky::Tokenizers::Query.default.tokenize(text.dup).to_a.map(&:to_s).map(&:to_sym)}"
  puts
  puts "(category qualifiers, e.g. title: are removed if they do not exist as a qualifier, so 'toitle:bla' -> 'bla')"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
picky-3.0.1 lib/tasks/try.rake