Class: D

Inherits:
Object show all
Defined in:
lib/picolena/templates/lib/development_helpers.rb

Overview

D.query displays matching_documents for query, and returns the document with the highest score. Useful for development and debugging purposes

D.test 71 document(s) found for test: for_test.txt some_test_files.zip plain.txt another_plain.text other_basic.PDF basic.pdf basic.odt basic.tex queens.for README ........... => "spec/test_dirs/indexed/just_one_doc/for_test.txt (82.7%)"

Class Method Summary collapse

Class Method Details

.[](query) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/picolena/templates/lib/development_helpers.rb', line 23

def self.[](query)
  f=Finder.new(query.to_s)
  hits=f.total_hits
  if hits > 0 then
    puts "#{hits} document(s) found for #{query}:"
    f.matching_documents.each{|doc| puts "  "+doc.filename} 
    puts "  ..........." if hits > f.matching_documents.size
    f.matching_documents.first
  else
    puts "Nothing found for #{query}"
  end
end

.method_missing(query, *params) ⇒ Object



20
21
22
# File 'lib/picolena/templates/lib/development_helpers.rb', line 20

def self.method_missing(query,*params)
  self[query.to_s] || super
end