Closed Penjor closed 3 months ago
I forgot to mention it was working the first time when I indexed. All posts with the company name was displayed in the result. Then I had to reindex the Post model through php artisan and the problems occurred. The only change I made was change the asYouType to true from false in the scout.php file. However, reverting the change and reindexing doesn't work now. And then I discovered the column name problem as stated above.
Hey, i've came across the same issue. However, it's something strange. If i save the model, gets indexed properly including relations. If i use the CLI command, it doesn't.
I don't know whether its a laravel scout problem or tntsearch problem. The issue is that I have references to several other relational models in the toSearchableArray function in the Post Model but the related models with the field name 'name' are not being indexed entirely (only first record is getting indexed). I have tried other columns and they are getting indexed. Then I figured it was the column with name as 'name' had problems. So I changed the column name of one of the related models to something else and it got indexed and appears in the search results as expected. However, doing that requires changing all model's name column and all references to the name column.
Here is my scout settings:
'tntsearch' => [ 'storage' => storage_path(), //place where the index files will be stored 'fuzziness' => env('TNTSEARCH_FUZZINESS', false), 'fuzzy' => [ 'prefix_length' => 2, 'max_expansions' => 50, 'distance' => 2 ], 'asYouType' => false, 'searchBoolean' => env('TNTSEARCH_BOOLEAN', false), ],
And below are the lines I added in Post Model: use Searchable;//for laravel scout
Any help will be appreciated.