diff --git a/Blacklight/NameFixer.php b/Blacklight/NameFixer.php index 4eda71b39..0d7d9d0fd 100755 --- a/Blacklight/NameFixer.php +++ b/Blacklight/NameFixer.php @@ -1034,6 +1034,7 @@ class NameFixer $taggedRelease->update($updateColumns); $taggedRelease->retag($determinedCategory['tags']); if (config('nntmux.elasticsearch_enabled') === true) { + $newTitle = str_replace(['.', '-'], ' ', $newTitle); $data = [ 'body' => [ 'doc' => [ @@ -1080,6 +1081,7 @@ class NameFixer ->groupBy('releases.id') ->first(); if ($new !== null) { + $newTitle = str_replace(['.', '-'], ' ', $newTitle); $data = [ 'body' => [ 'doc' => [ diff --git a/Blacklight/processing/post/ProcessAdditional.php b/Blacklight/processing/post/ProcessAdditional.php index 1c5a1a784..753ea71b9 100755 --- a/Blacklight/processing/post/ProcessAdditional.php +++ b/Blacklight/processing/post/ProcessAdditional.php @@ -1183,12 +1183,13 @@ class ProcessAdditional ->groupBy('releases.id') ->first(); if ($new !== null) { + $searchName = str_replace(['.', '-'], ' ', $new->searchname); $data = [ 'body' => [ 'doc' => [ 'id' => $this->_release->id, 'name' => $new->name, - 'searchname' => $new->searchname, + 'searchname' => $searchName, 'fromname' => $new->fromname, 'filename' => ! empty($new->filename) ? $new->filename : '', ], @@ -1764,6 +1765,7 @@ class ProcessAdditional $release->retag($newCat['tags']); if (config('nntmux.elasticsearch_enabled') === true) { + $newTitle = str_replace(['.', '-'], ' ', $newTitle); $data = [ 'body' => [ 'doc' => [ diff --git a/app/Console/Commands/NntmuxResetDb.php b/app/Console/Commands/NntmuxResetDb.php index b0a684c1a..eb79bf34f 100644 --- a/app/Console/Commands/NntmuxResetDb.php +++ b/app/Console/Commands/NntmuxResetDb.php @@ -98,6 +98,27 @@ class NntmuxResetDb extends Command 'number_of_shards' => 2, 'number_of_replicas' => 0, ], + 'mappings' => [ + 'properties' => [ + 'id' => [ + 'type' => 'long', + 'index' => false, + ], + 'name' => ['type' => 'text'], + 'searchname' => [ + 'type' => 'text', + 'fields' => [ + 'sort' => [ + 'type' => 'keyword', + ], + ], + ], + 'fromname' => ['type' => 'text'], + 'filename' => ['type' => 'text'], + 'add_date' => ['type' => 'date', 'format' => 'yyyy-MM-dd HH:mm:ss'], + 'post_date' => ['type' => 'date', 'format' => 'yyyy-MM-dd HH:mm:ss'], + ], + ], ], ]; @@ -108,13 +129,31 @@ class NntmuxResetDb extends Command } $predb_index = [ 'index' => 'predb', - 'type' => 'predb', 'body' => [ 'settings' => [ 'number_of_shards' => 2, 'number_of_replicas' => 0, ], + 'mappings' => [ + 'properties' => [ + 'id' => [ + 'type' => 'long', + 'index' => false, + ], + 'title' => [ + 'type' => 'text', + 'fields' => [ + 'sort' => [ + 'type' => 'keyword', + ], + ], + ], + 'filename' => ['type' => 'text'], + 'source' => ['type' => 'text'], + ], + ], ], + ]; \Elasticsearch::indices()->create($predb_index); diff --git a/app/Models/Release.php b/app/Models/Release.php index 6a721f1fe..09147e19a 100644 --- a/app/Models/Release.php +++ b/app/Models/Release.php @@ -364,6 +364,7 @@ class Release extends Model ); if (config('nntmux.elasticsearch_enabled') === true) { + $searchName = str_replace(['.', '-'], ' ', $searchName); $data = [ 'body' => [ 'doc' => [ diff --git a/app/Models/ReleaseFile.php b/app/Models/ReleaseFile.php index 8457ff334..7ccf3791b 100644 --- a/app/Models/ReleaseFile.php +++ b/app/Models/ReleaseFile.php @@ -141,12 +141,13 @@ class ReleaseFile extends Model ->groupBy('releases.id') ->first(); if ($new !== null) { + $searchName = str_replace(['.', '-'], ' ', $new->searchname); $data = [ 'body' => [ 'doc' => [ 'id' => $id, 'name' => $new->name, - 'searchname' => $new->searchname, + 'searchname' => $searchName, 'fromname' => $new->fromname, 'filename' => ! empty($new->filename) ? $new->filename : '', ], diff --git a/misc/elasticsearch/populate_es_indexes.php b/misc/elasticsearch/populate_es_indexes.php index b26666fa2..446fcbb8c 100644 --- a/misc/elasticsearch/populate_es_indexes.php +++ b/misc/elasticsearch/populate_es_indexes.php @@ -70,6 +70,7 @@ function populate_indexes($table, $max) } switch ($table) { case 'releases': + $searchName = str_replace(['.', '-'], ' ', $row->searchname); $data['body'][] = [ 'index' => [ '_index' => 'releases', @@ -80,7 +81,7 @@ function populate_indexes($table, $max) $data['body'][] = [ 'id' => $row->id, 'name' => $row->name, - 'searchname' => $row->searchname, + 'searchname' => $searchName, 'fromname' => $row->fromname, 'filename' => $row->filename, 'add_date' => $row->adddate,