mirror of
https://github.com/jikan-me/jikan-rest.git
synced 2025-02-20 11:23:35 +08:00
improve anime query and indexing
This commit is contained in:
parent
5360606ac7
commit
afa3b64eba
@ -104,10 +104,11 @@ class SearchQueryBuilderAnime 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((string)[
|
||||
'$text' => [
|
||||
'$search' => $query
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
if (!is_null($letter)) {
|
||||
|
@ -23,21 +23,25 @@ class CreateAnimeTable extends Migration
|
||||
$table->index('title');
|
||||
$table->index('title_english');
|
||||
$table->index('title_japanese');
|
||||
$table->enum('type', ['TV', 'Movie', 'OVA', 'Special', 'ONA', 'Music']);
|
||||
$table->enum('type', ['TV', 'Movie', 'OVA', 'Special', 'ONA', 'Music'])->index('type');
|
||||
$table->index('source');
|
||||
$table->integer('episodes')->index('episodes');
|
||||
$table->string('status')->index();
|
||||
$table->boolean('airing');
|
||||
$table->string('duration');
|
||||
$table->string( 'duration');
|
||||
$table->string('rating')->index('rating');
|
||||
$table->float('score')->index('score');
|
||||
$table->integer('scored_by')->index('scored_by');
|
||||
$table->integer('rank')->index('rank')->nullable();
|
||||
$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('licensors.mal_id');
|
||||
$table->index('producers.mal_id');
|
||||
$table->index('studios.mal_id');
|
||||
$table->index(['aired.from' => 1], 'start_date');
|
||||
$table->index(['aired.to' => 1], 'end_date');
|
||||
$table->index([
|
||||
|
Loading…
x
Reference in New Issue
Block a user