public function indexDocument($document)
    {
        if(isset($document['_id']['type']))
        {
            $collection = $this->config->getCollectionForSearchDocument($this->storeName, $document['_id']['type']);
        }
        else
        {
            throw new \Tripod\Exceptions\SearchException("No search document type specified in document");
        }

        try {
            $result = $collection->updateOne(array('_id' => $document['_id']), array('$set' => $document), array('upsert' => true));
            if (!$result->isAcknowledged()) {
                throw new \Tripod\Exceptions\SearchException("Inserting search document not acknowledged");
            }
        } catch (\Exception $e) {
            throw new \Tripod\Exceptions\SearchException("Failed to Index Document \n" . print_r($document, true), 0, $e);
        }
    }
public function indexDocument($document)
    {
        if(isset($document['_id']['type']))
        {
            $collection = $this->config->getCollectionForSearchDocument($this->storeName, $document['_id']['type']);
        }
        else
        {
            throw new \Tripod\Exceptions\SearchException("No search document type specified in document");
        }

        try {
            $result = $collection->updateOne(array('_id' => $document['_id']), array('$set' => $document), array('upsert' => true));
            if (!$result->isAcknowledged()) {
                throw new \Tripod\Exceptions\SearchException("Inserting search document not acknowledged");
            }
        } catch (\Exception $e) {
            throw new \Tripod\Exceptions\SearchException("Failed to Index Document \n" . print_r($document, true), 0, $e);
        }
    }
public function indexDocument ( $ document ) { if ( isset ( $ document [ '_id' ] [ 'type' ] ) ) { $ collection = $ this -> config -> getCollectionForSearchDocument ( $ this -> storeName , $ document [ '_id' ] [ 'type' ] ) ; } else { throw new \ Tripod \ Exceptions \ SearchException ( "No search document type specified in document" ) ; } try { $ result = $ collection -> updateOne ( array ( '_id' => $ document [ '_id' ] ) , array ( '$set' => $ document ) , array ( 'upsert' => true ) ) ; if ( ! $ result -> isAcknowledged ( ) ) { throw new \ Tripod \ Exceptions \ SearchException ( "Inserting search document not acknowledged" ) ; } } catch ( \ Exception $ e ) { throw new \ Tripod \ Exceptions \ SearchException ( "Failed to Index Document \n" . print_r ( $ document , true ) , 0 , $ e ) ; } }
Indexes the given document
@param array $document the document to index
@throws \Tripod\Exceptions\SearchException if there was an error indexing the document
@return mixed
Indexes the given document