/** * Implements SearchEngineAbstract::indexDocument(). * * @param CollectionAbstract $collection * @param SolrIndexDocument $document */ public function indexDocument(CollectionAbstract $collection, IndexDocument $document) { $solarium_document = $this->_update->createDocument(); if (null !== ($boost = $document->getBoost())) { $solarium_document->setBoost($boost); } foreach ($document as $field_id => $normalized_value) { $field = $document->getField($field_id); $name = $field->getName(); $solarium_document->{$name} = $normalized_value; if (null !== ($boost = $field->getBoost())) { $solarium_document->setFieldBoost($name, $boost); } } $this->_documents[] = $solarium_document; }
/** * Implements SearchEngineAbstract::indexDocument(). * * @param CollectionAbstract $collection * @param IndexDocument $document */ public function indexDocument(CollectionAbstract $collection, IndexDocument $document) { $index_doc = array(); if (null !== ($boost = $document->getBoost())) { $index_doc['_boost'] = $boost; } foreach ($document as $field_id => $normalized_value) { $name = $document->getFieldName($field_id); $index_doc[$name] = $normalized_value; } $native_doc = new Elastica_Document(null, $index_doc); $native_doc->setIndex($this->_activeIndex); $native_doc->setType($collection->getType()); $this->_documents[] = $native_doc; }