Source for file Document.php
Documentation is available at Document.php
* @copyright Copyright 2007 Conduit Internet Technologies, Inc. (http://conduit-it.com)
* @license Apache Licence, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* @author Donovan Jimenez <djimenez@conduit-it.com>
* Holds Key / Value pairs that represent a Solr Document. Field values can be accessed
* by direct dereferencing such as:
* $document->title = 'Something';
* Additionally, the field values can be iterated with foreach
* foreach ($document as $key => $value)
private $_fields =
array();
* Magic get for field values
public function __get($key)
return $this->_fields[$key];
* Magic set for field values. Multi-valued fields should be set as arrays
* or instead use the setMultiValue(...) function which will automatically
* make sure the field is an array.
public function __set($key, $value)
$this->_fields[$key] =
$value;
* Magic isset for fields values. Do no call directly. Allows usage:
* isset($document->some_field);
return isset
($this->_fields[$key]);
* Magic unset for field values. Do no call directly. Allows usage:
* unset($document->some_field);
unset
($this->_fields[$key]);
* Handle the array manipulation for a multi-valued field
if (!isset
($this->_fields[$key]))
$this->_fields[$key] =
array();
$this->_fields[$key] =
array($this->_fields[key]);
$this->_fields[key][] =
$value;
* Get the names of all fields in this document
* Iterator implementation function, proxies to _fields. Allows usage:
* foreach ($document as $key => $value)
* Iterator implementation function, proxies to _fields. Allows usage:
* foreach ($document as $key => $value)
* Iterator implementation function, proxies to _fields. Allows usage:
* foreach ($document as $key => $value)
return key($this->_fields);
* Iterator implementation function, proxies to _fields. Allows usage:
* foreach ($document as $key => $value)
return next($this->_fields);
* Iterator implementation function, proxies to _fields. Allows usage:
* foreach ($document as $key => $value)
public function valid() {
return current($this->_fields) !==
false;
Documentation generated on Tue, 02 Oct 2007 12:55:37 -0400 by phpDocumentor 1.4.0