improve manga query and indexing

This commit is contained in:
Irfan 2021-06-29 01:53:38 +05:00
parent 7919b49c60
commit e75c0c7a62
2 changed files with 9 additions and 6 deletions

View File

@ -77,10 +77,11 @@ class SearchQueryBuilderManga implements SearchQueryBuilderInterface
if (!empty($query) && is_null($letter)) {
$results = $results
->where('title', 'like', "%{$query}%")
->orWhere('title_english', 'like', "%{$query}%")
->orWhere('title_japanese', 'like', "%{$query}%")
->orWhere('title_synonyms', 'like', "%{$query}%");
->whereRaw([
'$text' => [
'$search' => $query
]
]);
}
if (!is_null($letter)) {

View File

@ -27,13 +27,15 @@ class CreateMangaTable extends Migration
$table->string('status')->index();
$table->boolean('publishing');
$table->float('score')->index('score');
$table->integer('rank')->index('rank')->nullable();
$table->float('scored_by')->index('scored_by');
$table->integer('rank')->index('rank');
$table->integer('popularity')->index('popularity');
$table->integer('members')->index('members');
$table->integer('favorites')->index('favorites');
$table->string('synopsis')->nullable();
$table->string('background')->nullable();
$table->index('genres');
$table->index('genres.mal_id');
$table->index('serializations.mal_id');
$table->index(['published.from' => 1], 'start_date');
$table->index(['published.to' => 1], 'end_date');
$table->index([