Class | Estraier::Document |
In: |
estraier-doc.rb
|
Parent: | Object |
++ Abstraction of document.
Add an attribute. `name’ specifies the name of an attribute. `value’ specifies the value of the attribute. If it is `nil’, the attribute is removed. The return value is always `nil’.
Get the value of an attribute. `name’ specifies the name of an attribute. The return value is the value of the attribute or `nil’ if it does not exist.
Get an array of attribute names of a document object. The return value is an array object of attribute names.
Get the ID number. The return value is the ID number of the document object. If the object has never been registered, -1 is returned.
Get attached keywords. The return value is a hash object of keywords and their scores in decimal string. If no keyword is attached, `nil’ is returned.
Make a snippet of the body text. `words’ specifies an array object of words to be highlight. `wwidth’ specifies whole width of the result. `hwidth’ specifies width of strings picked up from the beginning of the text. `awidth’ width of strings picked up around each highlighted word. The return value is a snippet string of the body text. There are tab separated values. Each line is a string to be shown. Though most lines have only one field, some lines have two fields. If the second field exists, the first field is to be shown with highlighted, and the second field means its normalized form.
Attach keywords. `kwords’ specifies a hash object of keywords. Keys of the hash should be keywords of the document and values should be their scores in decimal string. The return value is always `nil’.
Set the substitute score. `score’ specifies the substitute score. It it is negative, the substitute score setting is nullified. The return value is always `nil’.