# File lib/myrurema.rb, line 62
  def search(query, ver)
    should_have_db(ver)

    args = Array(query).map{|s| Shellwords.escape s}.join(" ")
    cmd = "#{bitclust_path/'bin/refe'}" +
            " #{args} -d #{db_path(ver)}"
    sh cmd, :silent => true do |txt|
      lines = txt.lines.to_a
      if lines.count < 10 and
         lines.first(2).join =~ /#{query}.*#{query}/m and
         lines[1] !~ /^--- / and   # ad hoc :-(  see Issue #2
         !@opt.no_ask

        words = {}
        k = 0
        puts lines.map{|line|
          line.gsub(/(\S+)/){|str|
            k+=1
            words[k] = str
            "(#{k})#{str}"
          }
        }
        print "which one? > "
        line = $stdin.gets or (puts; exit)
        n = line.to_i

        puts "searching #{words[n]}"
        puts
        search(words[n].sub(/\.#/, "."), ver)
      else
        puts txt
      end
    end
  end