mstdmstd
mstdmstd

Reputation: 3129

Why do I have an empty “Searchable attributes” after import with 'algolia/scout-extended'?

In a Laravel 9 application, I have algolia/scout-extended 2.0.

Running on my local OS command

php artisan scout:optimize

I got several files like config/scout-search-pages.php, and I modified one of them:

'searchableAttributes' => [
    'page_title',
    'page_slug',
    'page_content',
    'page_content_shortly',
    'page_author_name',
    'page_author_email',
    'page_price',
    'page_categories',
    'page_created_at',

],


'customRanking' => ['asc(page_price)', 'desc(page_created_at)'],

And clearing the cache I run an import and after that I see a set of rows/columns I expected: https://prnt.sc/Ew0BdaH3dvON

  1. But on the “Configuration” tab I see an empty “Searchable attributes” list, and I have to add fields manually. I expected that these fields must be filled automatically from “searchableAttributes” option, but not.

  2. After I added more columns at “Add a Searchable Attribute” I see “unordered/unordered” option for fields. How does it work and which option do I have to select?

The source table on MySQL 8 side has this structure:

CREATE TABLE `search_pages` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `page_title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `page_slug` varchar(260) COLLATE utf8mb4_unicode_ci NOT NULL,
  `page_content` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `page_content_shortly` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `page_author_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `page_author_email` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `page_price` decimal(9,2) NOT NULL DEFAULT '0.00',
  `page_categories` json DEFAULT NULL,
  `page_created_at` timestamp NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `search_pages_page_slug_unique` (`page_slug`),
  KEY `search_pages_page_author_name_page_title_index` (`page_author_name`,`page_title`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Upvotes: 1

Views: 161

Answers (0)

Related Questions