Removes a searchable model from indices.

@param SearchableInterface $searchableModel

@return array
@throws \InvalidArgumentException
345179
public function removeFromIndices(SearchableInterface $searchableModel)
    {
        $indices = $indices = $this->initIndices($searchableModel);
        $objectID = $searchableModel->getObjectID();

        return $this->processIndices($indices, function (Index $index) use ($objectID) {
            return $index->deleteObject($objectID);
        });
    }
625580
public function transform(Arrayable $model)
    {
        $result = $model->toArray();
        if ($model instanceof Model) {
            $result = $this->datesToISO8601($result, $model);
            $result = $this->removeHiddenFields($result, $model);
        } else {
            $result = $this->formatDatesInArray($result);
        }

        return $result;
    }
91254
public function removeFromIndex(Searchable $subject, $indexName = null)
    {
        $indexName = $this->resolveIndexName($indexName);

        $this->elasticsearch->delete(
            [
                'index' => $indexName,
                'type'  => $subject->getSearchableType(),
                'id'    => $subject->getSearchableId(),
            ]
        );
    }
1198693
public function deleted(Model $model)
    {
        // Delete corresponding $model document from Elasticsearch
        Queue::push('Iverberk\Larasearch\Jobs\DeleteJob', [get_class($model) . ':' . $model->getKey()]);

        // Update all related model documents to reflect that $model has been removed
        Queue::push('Iverberk\Larasearch\Jobs\ReindexJob', $this->findAffectedModels($model, true));
    }
191116
protected function modelOrFind($idOrModel)
    {
    	if ($idOrModel instanceof Model && $idOrModel->exists()) {
    		return $idOrModel;
    	}

    	return $this->getModel()->findOrFail($idOrModel);
    }
1151694
public function willRemove(AbstractModel $model)
    {
        $key = $model->getCompositeKey();
        return isset($this->removed[$key]);
    }
1286121
public function flush($model)
    {
        $indexName   = $model->searchableAs();
        $pathToIndex = $this->tnt->config['storage']."/{$indexName}.index";
        if (file_exists($pathToIndex)) {
            unlink($pathToIndex);
        }
    }
522882
protected function handleDELETE()
    {
        /** @var BaseSystemModel $modelClass */
        $modelClass = static::$model;
        $options = $this->request->getParameters();

        if (!empty($this->resource)) {
            return $modelClass::deleteById($this->resource, $options);
        }

        if (!empty($ids = array_get($options, ApiOptions::IDS))) {
            $result = $modelClass::deleteByIds($ids, $options);
        } else {
            $records = ResourcesWrapper::unwrapResources($this->getPayloadData());
            if (!empty($records)) {
                $result = $modelClass::bulkDelete($records, $options);
            } else {
                $filter = array_get($options, ApiOptions::FILTER);
                if (!empty($filter)) {
                    $params = array_get($options, ApiOptions::PARAMS, []);
                    $result = $modelClass::deleteByFilter($filter, $params, $options);
                } else {
                    if (!array_get_bool($options, ApiOptions::FORCE)) {
                        throw new BadRequestException('No filter or records given for delete request.');
                    }

                    return $modelClass::truncate($options);
                }
            }
        }

        $asList = $this->request->getParameterAsBool(ApiOptions::AS_LIST);
        $idField = $this->request->getParameter(ApiOptions::ID_FIELD, static::getResourceIdentifier());
        $result = ResourcesWrapper::cleanResources($result, $asList, $idField, ApiOptions::FIELDS_ALL);

        return $result;
    }
1323481
public function removeModel(ModelInterface $model): ModelCollectionInterface
    {
        if (isset($this->models[$model->getId()])) {
            $this->propertyReflection->setValue($model, null);

            unset($this->models[$model->getId()]);
        }

        return $this;
    }
1000403
public function getModel($model)
    {
        if ($model instanceof Model) {
            return $model;
        }

        if (is_string($model) && class_exists($model)) {
            return $this->getModel(new $model());
        }

        throw new InvalidArgumentException("$model is not a valid model");
    }
406941
public function delete(Model\ContainerInterface $container)
    {
        // Ensure not named / alone
        if ($container->isAlone() || $container->isNamed() || $container->isTitled()) {
            throw new InvalidOperationException(
                "The container can't be removed because it is named or the parent content does not have enough children."
            );
        }

        // Check if the container is not the only content container (a content must have at least one container).
        if (null === $content = $container->getContent()) {
            throw new InvalidOperationException(
                "The container does not belong to a content and therefore can't be removed."
            );
        }

        // Plugin remove
        $this->editor
            ->getContainerPlugin($container->getType())
            ->remove($container);

        $content->removeContainer($container);

        $this->editor
            ->getContentManager()
            ->fixContainersPositions($content);

        return $container;
    }
612064
protected function invalidate(Model $model): void
    {
        $key = $this->prefix . ":" . $model->getKey();
        if ($this->cacheRepository->has($key)) {
            $this->cacheRepository->forget($key);
        }
        $this->cacheRepository->forget("$this->prefix.:all");
    }
519358
public function getAllByModel($itemModel)
    {
        if (!empty($itemModel)) {
            $uri = ($itemModel instanceof core_kernel_classes_Resource) ? $itemModel->getUri() : $itemModel;
            return $this->itemClass->searchInstances(array(
                $this->itemModelProperty->getUri() => $uri
            ), array(
                'recursive' => true
            ));
        }
        return array();
    }
500758
public function remove(Builder $builder, Model $model) {
    $column = $model->getQualifiedSingleTableTypeColumn();

    $query = $builder->getQuery();

    $bindings = $query->getRawBindings()['where'];
    foreach ((array) $query->wheres as $key => $where) {
      // If the where clause is a single table inheritance in constraint, we will remove it from
      // the query and reset the keys on the wheres. This allows this developer to
      // include model in a relationship result set that is lazy loaded.

      if ($this->isSingleTableInheritanceConstraint($where, $column)) {
        unset($query->wheres[$key]);

        // Assume (naively) that no other scope is binding the same values as the values of our in query.
        // Not perfect but its about the best we can do without they query keeping better track of which bindings
        // belong to which where clause.
        foreach($where['values'] as $value) {
          if (($binding_key = array_search($value, $bindings)) >= 0) {
            unset($bindings[$binding_key]);
          }
        }

        $query->setBindings(array_values($bindings));
        $query->wheres = array_values($query->wheres);
      }
    }
  }
294709
public function remove($index)
    {
        if (!$index instanceof EntityInterface) {
            $index = $this->getRepository()->get($index);
        }
        
        return $this->findAndRemove($index);
    }
1131381
public function Search($SearchModel) {
		$SearchModel->AddSearch($this->DiscussionSql($SearchModel));
		$SearchModel->AddSearch($this->CommentSql($SearchModel));
	}
1300016
public function deleteDocumentIndexes($documentName)
    {
        $class = $this->dm->getClassMetadata($documentName);
        if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
            throw new \InvalidArgumentException('Cannot delete document indexes for mapped super classes or embedded documents.');
        }
        $this->dm->getDocumentCollection($documentName)->deleteIndexes();
    }