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. Your config.php file should look similar to this:

<?php

$config['dexter'] = [
    'provider' => 'meilisearch',
    ...
];

The full default config.

<?php

return [
    // 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. If you're using EEs .env.php file, you can
    // set this to $_ENV['ENVIRONMENT'] to read from the .env.php file.
    'env' => 'test',

    // Add a suffix to the end of all indices. Useful for multilingual sites.
    // If you are using Publisher this value should be left blanks as it will automatically be updated.
    // 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. Files from upload destinations can
    // also be indexed. Since they do not have short names like channels, you need to name them "upload_dir_N",
    // where N is the upload directory ID. Dexter can not target specific subdirectories within an upload destination.
    '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',
        // 'upload_dir_5' => 'images',
        // 'upload_dir_10' => 'documents',
    ],

    // 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,

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

    // Pipelies applied only when indexing files.
    'filePipelines' => [
        // MyCustomFilePipeline::class,
    ],

    // By default, the following properties will be indexed for files:
    // description, credit, location, file_name, file_id, file_size, site_id, upload_date, modified_date, url
    // If you would like to include additional properties you can add them to this array. The contents of this array
    // will replace the default properties.
    'fileIndexableProperties' => [],

    // If indexing files, and a pdf, txt, csv, or other text-based file is uploaded it will try to scrape the contents
    // of the file and add it to the __full_text property.
    'parseFileContents' =>  [
        'enabled' => true,
        'options' => [
            'maxPages' => 5, // Limit the number of pages to parse from a text file.
            'maxWords' => 1000, // Limit the number of words to parse from a text file.
        ],
    ],

    // 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. By default, the values of this field will be "entry_123" or "file_456",
    // depending on if your indexing entries or files.
    // 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?