## Class Apache_Solr_Document

Description

Implements interfaces:

- IteratorAggregate (internal interface)

Holds Key / Value pairs that represent a Solr Document along with any associated boost values. Field values can be accessed by direct dereferencing such as:

$document->title = 'Something'; echo $document->title; ... </code>

Additionally, the field values can be iterated with foreach

1. foreach ($document as $fieldName => $fieldValue)
2. {
3. ...
4. }

Located in /Document.php (line 58)

Class Constant Summary
SVN_ID = '$Id: Document.php 15 2009-08-04 17:53:08Z donovan.jimenez $'
SVN_REVISION = '$Revision: 15 $'
Variable Summary
float $_documentBoost
array $_fieldBoosts
array $_fields
Method Summary
void addField (string $key, mixed $value, [mixed $boost = false])
void clear ()
mixed getBoost ()
mixed getField (string $key)
float getFieldBoost (string $key)
array getFieldBoosts ()
array getFieldNames ()
array getFieldValues ()
void getIterator ()
void setBoost (mixed $boost)
void setField (string $key, mixed $value, [mixed $boost = false])
void setFieldBoost (string $key, mixed $boost)
void setMultiValue (string $key, string $value, [mixed $boost = false])
mixed __get (string $key)
boolean __isset (string $key)
void __set (string $key, mixed $value)
void __unset (string $key)
Variables
float $_documentBoost = false (line 75)

Document boost value

- access: protected

array $_fieldBoosts = array() (line 89)

Document field boost values, indexed by name

- var: array of floats
- access: protected

array $_fields = array() (line 82)

Document field values, indexed by name

- access: protected

Methods
addField (line 154)

Add a value to a multi-valued field

NOTE: the solr XML format allows you to specify boosts PER value even though the underlying Lucene implementation only allows a boost per field. To remedy this, the final field boost value will be the product of all specified boosts on field values - this is similar to SolrJ's functionality.

1. $doc = new Apache_Solr_Document();
3. $doc->addField('foo', 'bar', 2.0);
4. $doc->addField('foo', 'baz', 3.0);
6. // resultant field boost will be 6!
7. echo $doc->getFieldBoost('foo');

- access: public

void addField (string $key, mixed $value, [mixed $boost = false])

- string $key
- mixed $value
- mixed $boost: Use false for default boost, else cast to float that should be > 0 or will be treated as false

clear (line 94)

Clear all boosts and fields from this document

- access: public

void clear ()
getBoost (line 107)

Get current document boost

- return: will be false for default, or else a float
- access: public

mixed getBoost ()
getField (line 202)

Get field information

- return: associative array of info if field exists, false otherwise
- access: public

mixed getField (string $key)

- string $key

getFieldBoost (line 237)

Get the currently set field boost for a document field

- return: currently set field boost, false if one is not set
- access: public

float getFieldBoost (string $key)

- string $key

getFieldBoosts (line 267)

Return current field boosts, indexed by field name

- access: public

array getFieldBoosts ()
getFieldNames (line 277)

Get the names of all fields in this document

- access: public

array getFieldNames ()
getFieldValues (line 287)

Get the values of all fields in this document

- access: public

array getFieldValues ()
getIterator (line 302)

IteratorAggregate implementation function. Allows usage:

1. foreach ($document as $key => $value)
2. {
3. ...
4. }

- access: public

void getIterator ()

Implementation of:

IteratorAggregate::getIterator

setBoost (line 117)

Set document boost factor

- access: public

void setBoost (mixed $boost)

- mixed $boost: Use false for default boost, else cast to float that should be > 0 or will be treated as false

setField (line 225)

Set a field value. Multi-valued fields should be set as arrays or instead use the addField(...) function which will automatically make sure the field is an array.

- access: public

void setField (string $key, mixed $value, [mixed $boost = false])

- string $key
- mixed $value
- mixed $boost: Use false for default boost, else cast to float that should be > 0 or will be treated as false

setFieldBoost (line 248)

Set the field boost for a document field

- access: public

void setFieldBoost (string $key, mixed $boost)

- string $key: field name for the boost
- mixed $boost: Use false for default boost, else cast to float that should be > 0 or will be treated as false

setMultiValue (line 191)

Handle the array manipulation for a multi-valued field

- deprecated: Use addField(...) instead
- access: public

void setMultiValue (string $key, string $value, [mixed $boost = false])

- string $key
- string $value
- mixed $boost: Use false for default boost, else cast to float that should be > 0 or will be treated as false

__get (line 315)

Magic get for field values

- access: public

mixed __get (string $key)

- string $key

__isset (line 343)

Magic isset for fields values. Do not call directly. Allows usage:

1. isset($document->some_field);

- access: public

boolean __isset (string $key)

- string $key

__set (line 328)

Magic set for field values. Multi-valued fields should be set as arrays or instead use the addField(...) function which will automatically make sure the field is an array.

- access: public

void __set (string $key, mixed $value)

- string $key
- mixed $value

__unset (line 357)

Magic unset for field values. Do not call directly. Allows usage:

1. unset($document->some_field);

- access: public

void __unset (string $key)

- string $key

Class Constants
SVN_ID = '$Id: Document.php 15 2009-08-04 17:53:08Z donovan.jimenez $' (line 68)

SVN ID meta data for this class

SVN_REVISION = '$Revision: 15 $' (line 63)

SVN Revision meta data for this class

Documentation generated on Mon, 09 Nov 2009 18:15:42 -0500 by phpDocumentor 1.4.2