/** * 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 CollectionAbstract::buildDocument(). * * @param IndexDocument $document * @param \SimplePie_Item $data */ public function buildDocument(IndexDocument $document, $data) { $document->source = $this->_feed->get_title(); $document->subject = $this->_feed->get_description(); $document->title = $data->get_title(); $document->link = $data->get_link(); $document->description = $data->get_description(); $document->creator = (array) $data->get_author(); $document->date = $data->get_date(); // PHP properties cannot have dashes (-), and the fields below have // dashes in the field name. $document->source_link = $this->_feed->get_link(); $document->getField('source_link')->setName('source-link'); $document->item_subject = $this->_feed->get_link(); $document->getField('item_subject')->setName('item-subject'); }
/** * 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; }