#! %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] filename = ARGV[1]; properties = { "filename" => filename, "title" => filename, "last_modified" => File.mtime(filename).to_s, "filesize" => File.size(filename), } text = File.read(filename) Rast::DB.open(dbpath, Rast::DB::RDWR) do |db| doc_id = db.register(text, properties) printf("doc_id: %d\n", doc_id) end