Closed vezlius closed 3 months ago
I'm seeing the same thing. toSearchableArray
doesn't appear to have any impact on the search results
same for me ... toSearchableArray has no impact on search results
edit: i had to use scout:import App\Model instead of tntsearch:import App\Model
I think I have the same issue. I can manually build the index using createIndex(), but updates and edits to the model are ignored.
Here's the full exception
ErrorException : mb_strtolower() expects parameter 1 to be string, array given
at /Users/XXX/Dropbox/laravel/XXX/vendor/teamtnt/tntsearch/src/Support/Tokenizer.php:8
4| class Tokenizer implements TokenizerInterface
5| {
6| public function tokenize($text, $stopwords = [])
7| {
> 8| $text = mb_strtolower($text);
9| $split = preg_split("/[^\p{L}\p{N}]+/u", $text, -1, PREG_SPLIT_NO_EMPTY);
10| return array_diff($split, $stopwords);
11| }
12| }
This happens when you reference an eloquent relationship, e.g. if you were indexing a Post
that hasOne->(Author)
, and you're trying return $this->author->name
(as an example) within a toSearchableArray()
.
If I want to load relationship tasks in a parent's model toSearchableArray() method
I get this error: _ErrorException: mbstrtolower() expects parameter 1 to be string, array given
or, if I want to adjust array in the same method...
...it doesn't append new value. It's like nothing ever happened.
Everything works as intended when I try different search driver. Any ideas?