Class: Document

helma.Search.Document(document)

Instances of this class represent a single index document. This class provides various methods for adding content to such documents.

Constructor

new Document(document)

Creates a new instance of helma.Search.Document.
Parameters:
Name Type Description
document org.apache.lucene.document.Document Optional Lucene Document object that should be wrapped by this Document instance.
Source:

Classes

Field

Methods

addField(name, value, options)

Adds a field to this document.
Parameters:
Name Type Description
name String | helma.Search.Document.Field The name of the field, or an instance of helma.Search.Document.Field, in which case the other arguments are ignored.
value String The value of the field
options Object Optional object containing the following properties (each of them is optional too):
  • store (String) Defines whether and how the value is stored in the field. Accepted values are "no", "yes" and "compress" (defaults to "yes")
  • index (String) Defines whether and how the value is indexed in the field. Accepted values are "no", "tokenized", "unTokenized" and "noNorms" (defaults to "tokenized")
  • termVector (String) Defines if and how the fiels should have term vectors. Accepted values are "no", "yes", "withOffsets", "withPositions" and "withPositionsAndOffsets" (defaults to "no")
Source:

getBoost()

Returns the boost factor of a document.
Source:
Returns:
The boost factor of a document

getDocument()

Returns the wrapped Lucene Document object
Source:
Returns:
The wrapped Document object

getField(name)

Returns a single document field.
Parameters:
Name Type Description
name String The name of the field in this document object.
Source:
Returns:
The field with the given name

getFields(name)

Returns the fields of a document object. If a name is passed as argument, this method returns only the fields with the given name
Parameters:
Name Type Description
name String Optional name of the fields to return
Source:
Returns:
An array containing all fields in this document object.

removeField(name)

Removes all fields with the given name from this document
Parameters:
Name Type Description
name String The name of the field(s) to remove
Source:

setBoost(boost)

Sets the boost factor of a document.
Parameters:
Name Type Description
boost Number The boost factor of the document
Source: