Configuration

Below is an example of Dexter's default settings. Add it to your ExpressionEngine system/user/config/config.php file. You do not have to copy the entire array. Array keys not found in your config.php file will fall back to the default values.

<?php

$config['dexter'] = [
    // Choose which provider you're using.
    'provider' => 'meilisearch', // or "algolia"

    // Then set the required config values for it.
    'algolia' => [
        'appId' => '',
        'apiKey' => '',
    ],
    'meilisearch' => [
        'url' => '',
        'appKey' => '',
    ],

    // A prefix will be added to each index based on the environment.
    'env' => 'test',

    // Add a suffix to the end of all indices. Useful for multilingual sites.
    // Can be a string or a callable function. For example:
    /*
    'suffix' => function (...$args) {
        $request = ee('publisher:Request');
        $lang = $request->getCurrentLanguage();
        return '_' . $lang->getShortName();
    },
    */
    'suffix' => '',

    // Add the group ID(s) to be used to construct a menu a hierarchical menus, specifically
    // designed to render output necessary for Algolia's React HierarchicalMenu component
    // https://www.algolia.com/doc/api-reference/widgets/hierarchical-menu/react/
    'categoryMenuGroups' => [],

    // Any other category groups. Will index with the group name as the object key, and each
    // assigned category within the group with its ID and name.
    'categoryGroups' => [],

    // Similar to categoryGroups where you add the group ID to this config array, but will index
    // as a flat list of categories in an array, regardless of the group.
    'categories' => [],

    // A list of custom field names to be indexed.
    'customFields' => [],

    // Required - only entries within the defined channels will be indexed
    'indices' => [
        // Multiple channels can add content to the same index
        // 'channel_name_a' => 'index_name_a',
        // 'channel_name_b' => 'index_name_a',
        // 'channel_name_c' => 'index_name_b',
    ],

    // Adds a __full_text property when indexing entries which is a conglomeration of all text found in individual
    // fields being indexed. Useful for full text searches.
    'includeFullText' => true,

    'imageFields' => [],

    // Custom pipelines for additional customization.
    // Need to be properly namespaced, but can be loaded from anywhere.
    'pipelines' => [
        // MyCustomPipeline::class,
        // \BoldMinded\DexterPipelines\Pipelines\ExamplePipeline::class,
    ],

    // This is the property name that is used for the index primaryKey. In most cases the default "objectID" is sufficient.
    // https://www.meilisearch.com/docs/learn/getting_started/primary_key
    // If in the event you want to change the primary key name (you can set it to "entry_id" if you want), you can
    // set the config value to a callable function. For example:
    /*
    'primaryKey' => function (string $indexName, array $values) {
        return ''; // do something fancy here
    },
    */
    'primaryKey' => 'objectID',

    // This can be overridden in $config['dexter'], but not recommended.
    // This is the baseline data of what is indexed unless something is added to customFields.
    'requiredFields' => [
        'title',
        'url_title',
        'entry_id',
        'site_id',
        'status',
        'categories',
        'entry_date',
        'edit_date',
    ],

    // Only entries with the following statuses will be indexed
    'statuses' => [
        'open',
    ],

    // Highly recommended to use the Queue module if you need to batch re-index hundreds or thousands of entries.
    'useQueue' => true,
];

Last updated

Was this helpful?