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 57)


	
			
Variable Summary
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 64)

Document boost value

  • access: protected
array $_fieldBoosts = array() (line 78)

Document field boost values, indexed by name

  • var: array of floats
  • access: protected
array $_fields = array() (line 71)

Document field values, indexed by name

  • access: protected
Methods
addField (line 143)

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();
  2.  
  3.  $doc->addField('foo''bar'2.0);
  4.  $doc->addField('foo''baz'3.0);
  5.  
  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 83)

Clear all boosts and fields from this document

  • access: public
void clear ()
getBoost (line 96)

Get current document boost

  • return: will be false for default, or else a float
  • access: public
mixed getBoost ()
getField (line 191)

Get field information

  • return: associative array of info if field exists, false otherwise
  • access: public
mixed getField (string $key)
  • string $key
getFieldBoost (line 226)

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 256)

Return current field boosts, indexed by field name

  • access: public
array getFieldBoosts ()
getFieldNames (line 266)

Get the names of all fields in this document

  • access: public
array getFieldNames ()
getFieldValues (line 276)

Get the values of all fields in this document

  • access: public
array getFieldValues ()
getIterator (line 291)

IteratorAggregate implementation function. Allows usage:

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

  • access: public
void getIterator ()

Implementation of:
IteratorAggregate::getIterator
setBoost (line 106)

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 214)

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 237)

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 180)

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 304)

Magic get for field values

  • access: public
mixed __get (string $key)
  • string $key
__isset (line 332)

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 317)

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 346)

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

  1.  unset($document->some_field);

  • access: public
void __unset (string $key)
  • string $key

Documentation generated on Wed, 11 Mar 2009 17:34:14 -0400 by phpDocumentor 1.4.2