mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-23 19:37:23 +08:00
add scout
This commit is contained in:
@@ -13,6 +13,7 @@ use App\Models\Peer;
|
||||
use App\Models\SearchBox;
|
||||
use App\Models\Snatch;
|
||||
use App\Models\Tag;
|
||||
use App\Models\Torrent;
|
||||
use App\Models\User;
|
||||
use App\Repositories\AgentAllowRepository;
|
||||
use App\Repositories\AttendanceRepository;
|
||||
@@ -30,6 +31,7 @@ use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Redis;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use JeroenG\Explorer\Infrastructure\Scout\ElasticEngine;
|
||||
use Rhilip\Bencode\Bencode;
|
||||
|
||||
class Test extends Command
|
||||
@@ -65,12 +67,15 @@ class Test extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$peerId = '-UT355W-%af%b0ky%86N%a6%17i%f8%c1%0a';
|
||||
$peerId = '-UT355W-%af%b0ky%86N%a6%17i%f8%c1%0a';
|
||||
$peerId = '-UT355W-%AF%B0ky%86N%A6%17i%F8%C1';
|
||||
$peerId = '-UT355W-%AF%B0ky%86N%A6%17i%F8%C1%0A';
|
||||
$r = strlen(urldecode($peerId));
|
||||
dd($r);
|
||||
$class = Torrent::class;
|
||||
try {
|
||||
$this->call("scout:import App\\Models\Torrent");
|
||||
} catch (\Throwable $e) {
|
||||
$this->info($e->getMessage());
|
||||
$lastQueryAsJson = ElasticEngine::debug()->json();
|
||||
dd($lastQueryAsJson);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
+31
-1
@@ -3,9 +3,13 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Repositories\TagRepository;
|
||||
use JeroenG\Explorer\Application\Explored;
|
||||
use Laravel\Scout\Searchable;
|
||||
|
||||
class Torrent extends NexusModel
|
||||
class Torrent extends NexusModel implements Explored
|
||||
{
|
||||
use Searchable;
|
||||
|
||||
protected $fillable = [
|
||||
'name', 'filename', 'save_as', 'descr', 'small_descr', 'ori_descr',
|
||||
'category', 'source', 'medium', 'codec', 'standard', 'processing', 'team', 'audiocodec',
|
||||
@@ -71,6 +75,32 @@ class Torrent extends NexusModel
|
||||
self::PROMOTION_ONE_THIRD_DOWN => ['text' => '30%', 'up_multiplier' => 1, 'down_multiplier' => 0.3],
|
||||
];
|
||||
|
||||
public function mappableAs(): array
|
||||
{
|
||||
return [
|
||||
'id' => 'long',
|
||||
'name' => 'text',
|
||||
'descr' => 'text',
|
||||
'source' => 'long',
|
||||
'leechers' => 'long',
|
||||
'seeders' => 'long',
|
||||
'added' => 'date',
|
||||
];
|
||||
}
|
||||
|
||||
public function toSearchableArray()
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'descr' => $this->descr,
|
||||
'source' => $this->source,
|
||||
'leechers' => $this->leechers,
|
||||
'seeders' => $this->seeders,
|
||||
'added' => $this->added,
|
||||
];
|
||||
}
|
||||
|
||||
public function getSpStateRealTextAttribute()
|
||||
{
|
||||
$spStateReal = $this->sp_state_real;
|
||||
|
||||
Reference in New Issue
Block a user