SearchableInterface
interface SearchableInterface
Internal shape for models that can be indexed and searched.
Application models gain this capability through the Searchable trait and do not need to implement this interface directly. Keep this shape compatible with the trait while widening collection boundaries to Model for engines.
Methods
Get the requested models from an array of object IDs.
Get a query builder for retrieving the requested models from an array of object IDs.
Sync the soft deleted status for this model into the metadata.
Get the Scout engine for the model.
Get the queue connection that should be used when syncing.
Get the queue that should be used with syncing.
Make the given model instance searchable.
Remove the given model instance from the search index.
Get the index name for the model when searching.
Get the index name for the model when indexing.
Get the indexable data array for the model.
Determine if the model should be searchable.
Determine if the model's search index should be updated.
Determine if the model existed in the search index prior to an update.
Determine if the model existed in the search index prior to deletion.
Get the value used to index the model.
Get the key name used to index the model.
Get the auto-incrementing key type for querying models.
Get all Scout related metadata.
Set a Scout related metadata.
Details
at line 30
static Builder
search(string $query = '', Closure|null $callback = null)
Perform a search against the model's indexed data.
at line 38
Collection
getScoutModelsByIds(Builder $builder, array $ids)
Get the requested models from an array of object IDs.
at line 46
Builder
queryScoutModelsByIds(Builder $builder, array $ids)
Get a query builder for retrieving the requested models from an array of object IDs.
at line 54
Collection
makeSearchableUsing(Collection $models)
Modify the collection of models being made searchable.
at line 61
SearchableInterface
pushSoftDeleteMetadata()
Sync the soft deleted status for this model into the metadata.
at line 66
Engine
searchableUsing()
Get the Scout engine for the model.
at line 71
string|null
syncWithSearchUsing()
Get the queue connection that should be used when syncing.
at line 76
string|null
syncWithSearchUsingQueue()
Get the queue that should be used with syncing.
at line 81
void
searchable()
Make the given model instance searchable.
at line 86
void
unsearchable()
Remove the given model instance from the search index.
at line 91
string
searchableAs()
Get the index name for the model when searching.
at line 96
string
indexableAs()
Get the index name for the model when indexing.
at line 101
array
toSearchableArray()
Get the indexable data array for the model.
at line 106
bool
shouldBeSearchable()
Determine if the model should be searchable.
at line 111
bool
searchIndexShouldBeUpdated()
Determine if the model's search index should be updated.
at line 116
bool
wasSearchableBeforeUpdate()
Determine if the model existed in the search index prior to an update.
at line 121
bool
wasSearchableBeforeDelete()
Determine if the model existed in the search index prior to deletion.
at line 126
mixed
getScoutKey()
Get the value used to index the model.
at line 131
string
getScoutKeyName()
Get the key name used to index the model.
at line 136
string
getScoutKeyType()
Get the auto-incrementing key type for querying models.
at line 141
array
scoutMetadata()
Get all Scout related metadata.
at line 148
SearchableInterface
withScoutMetadata(string $key, mixed $value)
Set a Scout related metadata.