#! %RUBY% # Copyright (C) 2005 Network Applied Communication Laboratory Co., Ltd. # # This file is part of Rast. # See the file COPYING for redistribution information. # require "rast" if ARGV.length < 2 $stderr.printf("usage: %s \n", $0) exit(1) end dbpath = ARGV[0] query = ARGV[1]; options = { "num_items" => 10, "need_summary" => true, "summary_nchars" => 200, "properties" => [ "filename", "title", "last_modified", "filesize", ], } Rast::DB.open(dbpath, Rast::DB::RDONLY) do |db| result = db.search(query, options) result.items.each do |item| puts("doc_id: #{item.doc_id}") puts("score: #{item.score}") puts("filename: #{item.properties[0]}") puts("title: #{item.properties[1]}") puts("last_modified: #{item.properties[2]}") puts("filesize: #{item.properties[3]}") puts("summary: #{item.summary}") puts puts end end