RomanStruk / manticore-scout-engine

Manticore Engine for Laravel Scout
Other
36 stars 3 forks source link

Getting error on creating index #50

Open Faridun1992 opened 4 days ago

Faridun1992 commented 4 days ago

public function scoutIndexMigration(): array { return [ 'fields' => [ 'id' => ['type' => 'bigint'], 'title' => ['type' => 'text'], 'subtitle' => ['type' => 'text'], 'text' => ['type' => 'text'], 'categories' => ['type' => 'string stored indexed'] ], 'settings' => [ 'min_prefix_len' => 3, 'min_infix_len' => 3, 'expand_keywords' => 1, ], ]; }

getting error php artisan manticore:index "App\Models\Post" SQLSTATE[42000]: Syntax error or access violation: 1064 P03: syntax error, unexpected TEXT, expecting identifier or tablename or MODIFY or TYPE near 'text text, categories string stored indexed) min_prefix_len = '3' min_infix_len = '3' expand_keywords = '1'' (Connection: manticore, SQL: CREATE TABLE posts(id bigint, title text, subtitle text, text text, categories string stored indexed) min_prefix_len = '3' min_infix_len = '3' expand_keywords = '1')

RomanStruk commented 4 days ago

I will try to reproduce if the problem exists will be fixed

RomanStruk commented 4 days ago
public function scoutIndexMigration(): array
{
return [
'fields' => [
'id' => ['type' => 'bigint'],
'title' => ['type' => 'text'],
'subtitle' => ['type' => 'text'],
'text' => ['type' => 'text'], // problem here
'categories' => ['type' => 'string stored indexed']
],
'settings' => [
'min_prefix_len' => 3,
'min_infix_len' => 3,
'expand_keywords' => 1,
],
];
}

'text' => ['type' => 'text'] conflict in the name of the column Try to use a different name