/** * Creates a search indexer with the given document type * * @param string $document_type the shortname of the document type to * index by. * @param MDB2_Driver_Common $db the database connection used by this * indexer. * @param boolean $new if true, this is a new search index and all indexed * words for the given document type are removed. If * false, we are appending to an existing index. * Defaults to false. * @param boolean $append if true, keywords keywords for documents that * are indexed are appended to the keywords that * may already exist for the document in the index. * Defaults to false. * * @see NateGoSearch::createDocumentType() * * @throws NateGoSearchDocumentTypeException if the document type shortname * does not exist. */ public function __construct($document_type, MDB2_Driver_Common $db, $new = false, $append = false) { // cache mb_string overloading status if (self::$use_mb_string === null) { self::$use_mb_string = extension_loaded('mbstring') && (ini_get('mbstring.func_overload') & 2) === 2; } $type = NateGoSearch::getDocumentType($db, $document_type); if ($type === null) { throw new NateGoSearchDocumentTypeException("Document type {$document_type} does not exist and cannot be " . "indexed. Document types must be created before being used.", 0, $document_type); } $this->document_type = $type; $this->db = $db; $this->new = $new; $this->append = $append; }