mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Add mysql fallback search switch, default is false
This commit is contained in:
@@ -168,8 +168,8 @@ class ReleaseSearchService
|
||||
}
|
||||
}
|
||||
|
||||
// Fall back to MySQL if both Elasticsearch and Manticore failed
|
||||
if (empty($searchResult)) {
|
||||
// Fall back to MySQL if both Elasticsearch and Manticore failed (only if enabled)
|
||||
if (empty($searchResult) && config('nntmux.mysql_search_fallback', false) === true) {
|
||||
if (config('app.debug')) {
|
||||
Log::debug('apiSearch: Falling back to MySQL search');
|
||||
}
|
||||
@@ -380,8 +380,8 @@ class ReleaseSearchService
|
||||
}
|
||||
}
|
||||
|
||||
// Fall back to MySQL if both Elasticsearch and Manticore failed
|
||||
if (empty($searchResult)) {
|
||||
// Fall back to MySQL if both Elasticsearch and Manticore failed (only if enabled)
|
||||
if (empty($searchResult) && config('nntmux.mysql_search_fallback', false) === true) {
|
||||
$searchResult = $this->performMySQLSearch(['searchname' => $searchName], $limit);
|
||||
}
|
||||
|
||||
@@ -529,8 +529,8 @@ class ReleaseSearchService
|
||||
}
|
||||
}
|
||||
|
||||
// Fall back to MySQL if both Elasticsearch and Manticore failed
|
||||
if (empty($searchResult)) {
|
||||
// Fall back to MySQL if both Elasticsearch and Manticore failed (only if enabled)
|
||||
if (empty($searchResult) && config('nntmux.mysql_search_fallback', false) === true) {
|
||||
$searchResult = $this->performMySQLSearch(['searchname' => $name], $limit);
|
||||
}
|
||||
|
||||
@@ -601,8 +601,8 @@ class ReleaseSearchService
|
||||
}
|
||||
}
|
||||
|
||||
// Fall back to MySQL if both Elasticsearch and Manticore failed
|
||||
if (empty($searchResult)) {
|
||||
// Fall back to MySQL if both Elasticsearch and Manticore failed (only if enabled)
|
||||
if (empty($searchResult) && config('nntmux.mysql_search_fallback', false) === true) {
|
||||
$searchResult = $this->performMySQLSearch(['searchname' => $name], $limit);
|
||||
}
|
||||
|
||||
@@ -679,8 +679,8 @@ class ReleaseSearchService
|
||||
}
|
||||
}
|
||||
|
||||
// Fall back to MySQL if both Elasticsearch and Manticore failed
|
||||
if (empty($searchResult)) {
|
||||
// Fall back to MySQL if both Elasticsearch and Manticore failed (only if enabled)
|
||||
if (empty($searchResult) && config('nntmux.mysql_search_fallback', false) === true) {
|
||||
$searchResult = $this->performMySQLSearch(['searchname' => $name], $limit);
|
||||
}
|
||||
|
||||
@@ -874,12 +874,16 @@ class ReleaseSearchService
|
||||
return Arr::wrap(Arr::get($searchResult, 'id'));
|
||||
}
|
||||
|
||||
// Fallback to MySQL LIKE search when both Elasticsearch and Manticore are unavailable
|
||||
if (config('app.debug')) {
|
||||
Log::debug('performIndexSearch: Falling back to MySQL search');
|
||||
// Fallback to MySQL LIKE search when both Elasticsearch and Manticore are unavailable (only if enabled)
|
||||
if (config('nntmux.mysql_search_fallback', false) === true) {
|
||||
if (config('app.debug')) {
|
||||
Log::debug('performIndexSearch: Falling back to MySQL search');
|
||||
}
|
||||
|
||||
return $this->performMySQLSearch($searchFields, $limit);
|
||||
}
|
||||
|
||||
return $this->performMySQLSearch($searchFields, $limit);
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,6 +20,7 @@ return [
|
||||
'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/')),
|
||||
'tmp_unzip_path' => env('TEMP_UNZIP_PATH', storage_path('tmp/unzip/')),
|
||||
|
||||
Reference in New Issue
Block a user