AlgoliaSearch\Index::deleteObject PHP Method

deleteObject() public method

Delete an object from the index.
public deleteObject ( integer | string $objectID ) : mixed
$objectID integer | string the unique identifier of object to delete
return mixed
    public function deleteObject($objectID)
    {
        if ($objectID == null || mb_strlen($objectID) == 0) {
            throw new \Exception('objectID is mandatory');
        }
        return $this->client->request($this->context, 'DELETE', '/1/indexes/' . $this->urlIndexName . '/' . urlencode($objectID), null, null, $this->context->writeHostsArray, $this->context->connectTimeout, $this->context->readTimeout);
    }

Usage Example

Example #1
0
 /**
  * Remove an item from the search index by type and id.
  *
  * @param string $type
  * @param int    $id
  */
 public function removeFromIndexByTypeAndId($type, $id)
 {
     $this->index->deleteObject($type . '-' . $id);
 }
All Usage Examples Of AlgoliaSearch\Index::deleteObject