Ruby extension for Rast.

Abstract

Rast is a full-text search system.

Rast::DB

Constants

Rast::DB::RDONLY
The flag to open database for reading.
Rast::DB::RDWR
The flag to open database for reading and writing.

Class methods

Rast::DB.create(db_name, options)
Create a database. This function do not open the created database. Use Rast::DB.open to open the database.
Parameters
db_name
The name of the database.
options
The options to create a database.
Rast::DB.open(db_name, flags, options)
Rast::DB.open(db_name, flags, options) { |db| ... }

Open the specified database.

If the optional code block is given, it will be passed database as an argument, and the database will automatically be closed when the block terminates.

Parameters
db_name
The name of the database.
flags

How to open.

Rast::DB::RDWR
  open for reading and writing
Rast::DB::RDONLY
  open for reading
options
The options to open the database.
Rast::DB.optimize(db_name[, options = nil])
Optimize the database.
Parameters
db_name
The name of the database.
options
The options to optimize the database.

Instance methods

byte_order
Return the byte order of the database.
encoding
Return the encoding of the database.
properties
Return the property definitions of the database.
db_sync_threshold_chars
Return the number of registered characters to start sync.
register(text, properties)
Register a document to the database. Returns the registered document ID.
Parameters
text
The text of the document.
properties
The property values of documents.
create_document
Create a document object to register the database.
sync
Sync registered data to files.
close
Close the database.
search(query, options)
Search documents in the database.
Parameters
query
The query string.
options
search options.
delete(doc_id)
Delete the document from the database.
Parameters
doc_id
The document ID.
update(doc_id, text, properties)
Update the document in the database. Returns the updated document ID.
Parameters
doc_id
The document ID.
text
The text of the document.
properties
The property values of documents.
get_text(doc_id)
Get the text of the document from the database. Returns the text of the document
Parameters
doc_id
The document ID.

Rast::LocalDB

Super class

Class methods

Rast::LocalDB.create(db_name, options)
Create a database. This function do not open the created database. Use Rast::DB.open to open the database.
Parameters
db_name
The name of the database.
options
The options to create a database.
Rast::LocalDB.open(db_name, flags, options)
Rast::LocalDB.open(db_name, flags, options) { |db| ... }

Open the specified database.

If the optional code block is given, it will be passed database as an argument, and the database will automatically be closed when the block terminates.

Parameters
db_name
The name of the database.
flags

How to open.

Rast::DB::RDWR
  open for reading and writing
Rast::DB::RDONLY
  open for reading
options
The options to open the database.

Rast::Merger

Super class

Class methods

Rast::Merger.open(merge_dbs)
Rast::Merger.open(merge_dbs) { |db| ... }

Merge some opened databases.

If the optional code block is given, it will be passed database as an argument, and the database will automatically be closed when the block terminates.

Parameters
merge_dbs
Some databases for merging.

Rast::XMLRPCClient

Super class

Class methods

Rast::XMLRPCClient.open(url, flags, options)

Open the specified remote Rast database.

If the optional code block is given, it will be passed database as an argument, and the database will automatically be closed when the block terminates.

Parameters
url
The url of the database.
flags

How to open.

Rast::DB::RDWR
  open for reading and writing
Rast::DB::RDONLY
  open for reading
options
The options to open the database.

Rast::Document

Instance methods

add_text(text)
Add text to the document.
Parameters
text
The text to add the document.
set_property(name, value)
Set property to the document.
Parameters
name
The property name.
value
The property value.
commit
Commit the document to database.
abort
Abort the document to database.
doc_id
Get the document ID of the document.

Rast::FilterChain

Class methods

Rast::FilterChain.new(doc[, text_filters = nil])
Creates filter chain.
Parameters
doc
The document.
text_filters
The text filter names in Array.

Instance methods

invoke(brigade, mime_type[, filename = nil])
Start extracting text and properties with filters.
Parameters
brigade
The brigade stored data to extract text and properties.
mime_type
The mime-type to specify the file type of the brigade.
filename
The filename of the file to extract text and properties.

Rast::Brigade

Class methods

Rast::Brigade.new([bucket, ...])
Create Brigade.
Parameters
bucket
The bucket to store the brigade.

Instance methods

each { |bucket| ... }
Call block once for each bucket in brigade, passing that bucket as a parameter.
insert_tail(bucket)
Store bucket to tail of the brigade.

Rast::TransientBucket

Class methods

Rast::TransientBucket.new(str)
Create a bucket referring to a str.
Parameters
str
The string to put in the TransientBucket.

Instance methods

eos?
Return true if receiver is Rast::EOSBucket object.
file?
Return true if receiver is Rast::FileBucket object.
pipe?
Return true if receiver is Rast::PipeBucket object.
transient?
Return true if receiver is Rast::TransientBucket object.
read
Read data from receiver.

Rast::FileBucket

Class methods

Rast::FileBucket.new(file)
Create a bucket referring to a file.
Parameters
file
The file to put in the FileBucket.

Instance methods

eos?
Return true if receiver is Rast::EOSBucket object.
file?
Return true if receiver is Rast::FileBucket object.
pipe?
Return true if receiver is Rast::PipeBucket object.
transient?
Return true if receiver is Rast::TransientBucket object.
read
Read data from receiver.

Rast::PipeBucket

Class methods

Rast::PipeBucket.new(pipe)
Create a bucket referring to a pipe.
Parameters
pipe
The pipe to put in the PipeBucket.

Instance methods

eos?
Return true if receiver is Rast::EOSBucket object.
file?
Return true if receiver is Rast::FileBucket object.
pipe?
Return true if receiver is Rast::PipeBucket object.
transient?
Return true if receiver is Rast::TransientBucket object.
read
Read data from receiver.

Rast::EOSBucket

Class methods

Rast::EOSBucket.new
Create EOSBucket.

Instance methods

eos?
Return true if receiver is Rast::EOSBucket object.
file?
Return true if receiver is Rast::FileBucket object.
pipe?
Return true if receiver is Rast::PipeBucket object.
transient?
Return true if receiver is Rast::TransientBucket object.
read
Returns empty String.

Exceptions

Rast::RastError

raised if error relates Rast occured.

Rast::AprError

raised if error relates APR(Apache Portable Runtime) occured.

Rast::BDBError

raised if error relates BDB(Berkeley DB) occured.

Rast::RubyError

raised if error relates Ruby occured.