Sha256: 88db4ade66af99d554160f5c15b2b0abaa6a1ea6568a170930b2ea37f1d71579
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
# 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 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 puts "\"#{text}\" is query tokenized as #{Tokenizers::Default::Query.tokenize(text).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 Rake::Task[:"try:index"].invoke text, type_and_field Rake::Task[:"try:query"].invoke text end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
picky-0.9.2 | lib/tasks/try.rake |