For reference, I use Meilisearch with Scout. But these problems were identical when using Elasticsearch.
I feel like Scout is just... really lacking in features.
So far starters, to define which columns of a table should be searchable I have specify them in my model with "toSearchableArray".
public function toSearchableArray() {
$array = Arr::only(
$this->toArray(),
['id','title', 'link', 'raw_text', 'subchan', 'nsfw']
);
return $array;
}
Great. However, taking out "id" will result in non-discoverable elements within the search because by default the id is the primary key used for identifying a document. So you HAVE TO leave 'id' in toSearchableArray. This effectively exposes all your IDs for the table, as someone could just search "5341" and it would return the row with the primary ID of "5341".
Or let's say I want to filter by a column that isn't searchable, like created_at.
Comment::search($query, ['filters' => 'created_at > 795484800'])
Sorry, that doesn't work because created_at isn't indexed. And to index it you have to add it to toSearchableArray. And that makes it that column searchable, even if you don't want it to be.
Or let's take where clauses. Scout only allows for basic where clauses (https://laravel.com/docs/8.x/scout#where-clauses). And this is seriously the most basic where clauses, it doesn't even allow for where != equal to.
Has anyone else had similar experiences with Scout?