Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Explorer Laravel Package

jeroen-g/explorer

Laravel-friendly, fluent API for exploring and filtering directories and files. Chain common queries (name, extension, size, modified time), include/exclude patterns, sort and paginate results, and iterate over matches with clean, expressive code.

View on GitHub
Deep Wiki
Context7

Index settings

Most of the configuration you will be doing through the mapping of your index. However, if for example you want to define more advanced Elasticsearch settings such as analyzers or tokenizers you need to do so using index settings.

Be aware that any time you change the index settings, you need to recreate the index.

Using models

To start using index settings, we will expand on the Post model with an indexSettings function to set an analyzer.

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use JeroenG\Explorer\Application\Explored;
use JeroenG\Explorer\Application\IndexSettings;use Laravel\Scout\Searchable;

class Post extends Model implements Explored, IndexSettings
{
    use HasFactory;
    use Searchable;

    protected $fillable = ['title', 'published'];

    public function mappableAs(): array
    {
        return [
            'id' => 'keyword',
            'title' => 'text',
            'published' => 'boolean',
            'created_at' => 'date',
        ];
    }
    
    public function indexSettings(): array
    {
        return [
            'analysis' => [
                'analyzer' => [
                    'standard_lowercase' => [
                        'type' => 'custom',
                        'tokenizer' => 'standard',
                        'filter' => ['lowercase'],
                    ],
                ],
            ],
        ];
    }
}

If you want to create an analyzer object-oriented, continue reading here.

Using configuration arrays

If you want to use the configuration array notation (see mapping), you may add the settings as follows:

return [
    'indexes' => [
        'posts' => [
            'settings' => [
                'analysis' => [
                    'analyzer' => [
                        'standard_lowercase' => [
                            'type' => 'custom',
                            'tokenizer' => 'standard',
                            'filter' => ['lowercase'],
                        ],
                    ],
                ],
            ],
            'properties' => [
                'id' => 'keyword',
                'title' => 'text',
                'created_at' => 'date',
                'published' => 'boolean',
                'author' => 'nested',
            ],
        ],
    ],
];

Default index settings

If you want to set default index settings for all your indices, you can do so by adding the default_index_settings key to your configuration file:

return [
    'default_index_settings' => [
        'index' => [
            'max_result_window' => 100000,
        ],
        'analysis' => [
            'analyzer' => [
                'standard_lowercase' => [
                    'type' => 'custom',
                    'tokenizer' => 'standard',
                    'filter' => ['lowercase'],
                ],
            ],
        ],
    ],
];
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium