diff --git a/.env.dist b/.env.dist index 06df18516..274530c1d 100644 --- a/.env.dist +++ b/.env.dist @@ -9,8 +9,15 @@ DB_DATABASE=${DB_DATABASE} COMPOSER_AUTH='${COMPOSER_AUTH}' +# Search Driver: 'manticore' or 'elasticsearch' +SEARCH_DRIVER=${SEARCH_DRIVER} + MANTICORESEARCH_HOST=${MANTICORESEARCH_HOST} MANTICORESEARCH_PORT=${MANTICORESEARCH_PORT} +# ManticoreSearch Fuzzy Search Settings +MANTICORESEARCH_FUZZY_ENABLED=${MANTICORESEARCH_FUZZY_ENABLED} +MANTICORESEARCH_FUZZY_MAX_DISTANCE=${MANTICORESEARCH_FUZZY_MAX_DISTANCE} +MANTICORESEARCH_FUZZY_LAYOUTS=${MANTICORESEARCH_FUZZY_LAYOUTS} ELASTICSEARCH_HOST=${ELASTICSEARCH_HOST} ELASTICSEARCH_PORT=${ELASTICSEARCH_PORT} @@ -18,7 +25,11 @@ ELASTICSEARCH_SCHEME=${ELASTICSEARCH_SCHEME} ELASTICSEARCH_USER=${ELASTICSEARCH_USER} ELASTICSEARCH_PASS=${ELASTICSEARCH_PASS} ELASTICSEARCH_LOGGING=${ELASTICSEARCH_LOGGING} -ELASTICSEARCH_ENABLED=${ELASTICSEARCH_ENABLED} +# Elasticsearch Fuzzy Search Settings +ELASTICSEARCH_FUZZY_ENABLED=${ELASTICSEARCH_FUZZY_ENABLED} +ELASTICSEARCH_FUZZY_FUZZINESS=${ELASTICSEARCH_FUZZY_FUZZINESS} +ELASTICSEARCH_FUZZY_PREFIX_LENGTH=${ELASTICSEARCH_FUZZY_PREFIX_LENGTH} +ELASTICSEARCH_FUZZY_MAX_EXPANSIONS=${ELASTICSEARCH_FUZZY_MAX_EXPANSIONS} NNTP_COMPRESSED_HEADERS=${NNTP_COMPRESSED_HEADERS} USE_ALTERNATE_NNTP_SERVER=${USE_ALTERNATE_NNTP_SERVER} diff --git a/.env.example b/.env.example index 2d90ebacc..85f84f48d 100644 --- a/.env.example +++ b/.env.example @@ -33,7 +33,6 @@ ELASTICSEARCH_SCHEME=http ELASTICSEARCH_USER= ELASTICSEARCH_PASS= ELASTICSEARCH_LOGGING=false -ELASTICSEARCH_ENABLED=false #fuzzy search settings ELASTICSEARCH_FUZZY_ENABLED=false # Elasticsearch autocomplete settings diff --git a/app/Console/Commands/NntmuxResetDb.php b/app/Console/Commands/NntmuxResetDb.php index cbe02e819..744a17114 100644 --- a/app/Console/Commands/NntmuxResetDb.php +++ b/app/Console/Commands/NntmuxResetDb.php @@ -90,7 +90,7 @@ class NntmuxResetDb extends Command } unset($value); - if (config('nntmux.elasticsearch_enabled') === true) { + if (config('search.default') === 'elasticsearch') { if (\Elasticsearch::indices()->exists(['index' => 'releases'])) { \Elasticsearch::indices()->delete(['index' => 'releases']); } diff --git a/app/Services/AdditionalProcessing/Config/ProcessingConfiguration.php b/app/Services/AdditionalProcessing/Config/ProcessingConfiguration.php index 040d2866e..1222f7dc1 100644 --- a/app/Services/AdditionalProcessing/Config/ProcessingConfiguration.php +++ b/app/Services/AdditionalProcessing/Config/ProcessingConfiguration.php @@ -36,7 +36,8 @@ final readonly class ProcessingConfiguration public string $audioSavePath; public string $tmpUnrarPath; public bool $debugMode; - public bool $elasticsearchEnabled; + public bool $searchEnabled; + public string $searchDriver; public bool $renameMusicMediaInfo; public bool $renamePar2; public string|false $ffmpegPath; @@ -89,7 +90,8 @@ final readonly class ProcessingConfiguration $this->audioSavePath = config('nntmux_settings.covers_path').'/audiosample/'; $this->tmpUnrarPath = config('nntmux.tmp_unrar_path'); $this->debugMode = (bool) config('app.debug'); - $this->elasticsearchEnabled = config('nntmux.elasticsearch_enabled') === true; + $this->searchDriver = config('search.default', 'manticore'); + $this->searchEnabled = in_array($this->searchDriver, ['manticore', 'elasticsearch']); $this->renameMusicMediaInfo = (bool) config('nntmux.rename_music_mediainfo'); $this->renamePar2 = (bool) config('nntmux.rename_par2'); // Regex patterns diff --git a/app/Services/Releases/ReleaseSearchService.php b/app/Services/Releases/ReleaseSearchService.php index 3b545b593..3b60add91 100644 --- a/app/Services/Releases/ReleaseSearchService.php +++ b/app/Services/Releases/ReleaseSearchService.php @@ -810,11 +810,9 @@ class ReleaseSearchService return []; } - $esEnabled = config('nntmux.elasticsearch_enabled'); if (config('app.debug')) { Log::debug('performIndexSearch: starting search', [ - 'elasticsearch_enabled' => $esEnabled, - 'elasticsearch_enabled_type' => gettype($esEnabled), + 'search_driver' => config('search.default'), 'searchFields' => $searchFields, 'limit' => $limit, ]); diff --git a/config/nntmux.php b/config/nntmux.php index df4b74677..cc45f27e7 100644 --- a/config/nntmux.php +++ b/config/nntmux.php @@ -19,7 +19,6 @@ return [ 'stream_fork_output' => env('STREAM_FORK_OUTPUT', false), 'purge_inactive_users' => env('PURGE_INACTIVE_USERS', false), 'purge_inactive_users_days' => env('PURGE_INACTIVE_USERS_DAYS', 180), - 'elasticsearch_enabled' => env('ELASTICSEARCH_ENABLED', false), 'mysql_search_fallback' => env('MYSQL_SEARCH_FALLBACK', false), // Disable MySQL LIKE fallback when Manticore/Elasticsearch return no results 'btcpay_webhook_secret' => env('BTCPAY_SECRET'), 'tmp_unrar_path' => env('TEMP_UNRAR_PATH', storage_path('tmp/unrar/')),