Class EstraierPure::Node
In: estraierpure.rb
Parent: Object

++ Abstraction of connection to P2P node.


Methods

Public Class methods

Create a node connection object.

Public Instance methods

Get an array of names of administrators. The return value is an array object of names of administrators. On error, `nil’ is returned.

Get the usage ratio of the cache. The return value is the usage ratio of the cache. On error, -1.0 is returned.

Get the number of documents. The return value is the number of documents. On error, -1 is returned.

Edit attributes of a document. `doc’ specifies a document object. The return value is true if success, else it is false.

Extract keywords of a document. `id’ specifies the ID number of a registered document. The return value is a hash object of keywords and their scores in decimal string or `nil’ on error.

Extract keywords of a document specified by URI. `uri’ specifies the URI of a registered document. The return value is a hash object of keywords and their scores in decimal string or `nil’ on error.

Retrieve a document. `id’ specifies the ID number of a registered document. The return value is a document object. On error, `nil’ is returned.

Retrieve the value of an attribute of a document. `id’ specifies the ID number of a registered document. `name’ specifies the name of an attribute. The return value is the value of the attribute or `nil’ if it does not exist.

Retrieve the value of an attribute of a document specified by URI. `uri’ specifies the URI of a registered document. `name’ specifies the name of an attribute. The return value is the value of the attribute or `nil’ if it does not exist.

Retrieve a document. `uri’ specifies the URI of a registered document. The return value is a document object. On error, `nil’ is returned.

Get the label. The return value is the label. On error, `nil’ is returned.

Get an array of expressions of links. The return value is an array object of expressions of links. Each element is a TSV string and has three fields of the URL, the label, and the score. On error, `nil’ is returned.

Get the name. The return value is the name. On error, `nil’ is returned.

Optimize the database. The return value is true if success, else it is false.

Remove a document. `id’ specifies the ID number of a registered document. The return value is true if success, else it is false.

 Remove a document specified by URI.

`uri’ specifies the URI of a registered document. The return value is true if success, else it is false.

Add a document. `doc’ specifies a document object. The document object should have the URI attribute. The return value is true if success, else it is false.

Search for documents corresponding a condition. `cond’ specifies a condition object. `depth’ specifies the depth of meta search. The return value is a node result object. On error, `nil’ is returned.

Set the authentication information. `name’ specifies the name of authentication. `passwd’ specifies the password of the authentication. The return value is always `nil’.

Manage a link of a node. `url’ specifies the URL of the target node of a link. `label’ specifies the label of the link. `credit’ specifies the credit of the link. If it is negative, the link is removed. The return value is true if success, else it is false.

Set the proxy information. `host’ specifies the host name of a proxy server. `port’ specifies the port number of the proxy server. The return value is always `nil’.

Set width of snippet in the result. `wwidth’ specifies whole width of a snippet. By default, it is 480. If it is 0, no snippet is sent. If it is negative, whole body text is sent instead of snippet. `hwidth’ specifies width of strings picked up from the beginning of the text. By default, it is 96. If it is negative 0, the current setting is not changed. `awidth’ specifies width of strings picked up around each highlighted word. By default, it is 96. If it is negative, the current setting is not changed.

Set timeout of a connection. `sec’ specifies timeout of the connection in seconds. The return value is always `nil’.

Set the URL of a node server. `url’ specifies the URL of a node. The return value is always `nil’.

Manage a user account of a node. `name’ specifies the name of a user. `mode’ specifies the operation mode. 0 means to delete the account. 1 means to set the account as an administrator. 2 means to set the account as a guest. The return value is true if success, else it is false.

Get the size of the datbase. The return value is the size of the datbase. On error, -1.0 is returned.

Get the status code of the last request. The return value is the status code of the last request. -1 means failure of connection.

Synchronize updating contents of the database. The return value is true if success, else it is false.

Get the ID of a document specified by URI. `uri’ specifies the URI of a registered document. The return value is the ID of the document. On error, -1 is returned.

Get an array of names of users. The return value is an array object of names of users. On error, `nil’ is returned.

Get the number of unique words. The return value is the number of unique words. On error, -1 is returned.

[Validate]