/** * Indexes several content objects. * * Notes: * - Does not force a commit on solr, depends on solr config, use {@see commit()} if you need that. * - On large amounts of data make sure to iterate with several calls to this function with a limited * set of content objects, amount you have memory for depends on server, size of objects, & PHP version. * * @todo: This method, {@see purgeIndex}, & {@see commit()} is needed for being able to bulk index content. * However it is not added to an official SPI interface yet as we anticipate adding a bulkIndexDocument * using eZ\Publish\SPI\Search\Document instead of bulkIndexContent based on Content objects. However * that won't be added until we have several stable or close to stable advance search engines to make * sure we match the features of these. * See also {@see Solr\Content\Search\Gateway\Native::bulkIndexContent} for further Solr specific info. * * @param \eZ\Publish\SPI\Persistence\Content[] $contentObjects */ public function bulkIndexContent(array $contentObjects) { $documents = array(); foreach ($contentObjects as $content) { $documents[] = $this->mapper->mapContentBlock($content); } if (!empty($documents)) { $this->gateway->bulkIndexDocuments($documents); } }
/** * Index search documents generated by generateDocument method. * * Notes: * - Does not force a commit on solr, depends on solr config, use {@see commit()} if you need that. * - On large amounts of data make sure to iterate with several calls to this function with a limited * set of content objects, amount you have memory for depends on server, size of objects, & PHP version. * * @param \eZ\Publish\SPI\Search\Document[] $documents */ public function bulkIndexDocuments(array $documents) { $this->gateway->bulkIndexDocuments($documents); }