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.

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.
sync
Sync registered data to files.
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.
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.

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.