Update (fixes)
This commit is contained in:
@@ -28,7 +28,7 @@ public function searchResults(Request $request, $query)
|
|||||||
|
|
||||||
$breadcrumbs = collect([
|
$breadcrumbs = collect([
|
||||||
['name' => 'Home', 'url' => route('front.home')],
|
['name' => 'Home', 'url' => route('front.home')],
|
||||||
['name' => 'News Bites', 'url' => route('front.search.results',['query' => $query])],
|
['name' => 'News Bites', 'url' => route('front.all')],
|
||||||
['name' => $query, 'url' => null],
|
['name' => $query, 'url' => null],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ public function searchResults(Request $request, $query)
|
|||||||
|
|
||||||
$rss_posts = RssPost::with('category')
|
$rss_posts = RssPost::with('category')
|
||||||
->where('status', 'published')
|
->where('status', 'published')
|
||||||
->whereRaw("to_tsvector('english', title || ' ' || bites || ' ' || body) @@ plainto_tsquery('english', ?)", [trim(preg_replace('/\s+/', ' ', $query))])
|
->whereRaw("to_tsvector('english', title || ' ' || bites || ' ' || keyword_list) @@ plainto_tsquery('english', ?)", [trim(preg_replace('/\s+/', ' ', $query))])
|
||||||
->where('published_at', '<=', now())
|
->where('published_at', '<=', now())
|
||||||
->orderBy('published_at', 'desc')
|
->orderBy('published_at', 'desc')
|
||||||
->cursorPaginate(60);
|
->cursorPaginate(60);
|
||||||
|
|||||||
@@ -106,9 +106,7 @@ public static function handle(int $rss_post_id)
|
|||||||
$rss_post->category_id = $category->id;
|
$rss_post->category_id = $category->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$post_body = $rss_post->body;
|
$rss_post->keyword_list = implode(",", $words_to_add_in_body);
|
||||||
$post_body .= implode($words_to_add_in_body);
|
|
||||||
$rss_post->body = $post_body;
|
|
||||||
|
|
||||||
$rss_post->status = 'published';
|
$rss_post->status = 'published';
|
||||||
$rss_post->save();
|
$rss_post->save();
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
* @property string|null $entities
|
* @property string|null $entities
|
||||||
* @property string|null $metadata
|
* @property string|null $metadata
|
||||||
* @property string|null $bites
|
* @property string|null $bites
|
||||||
|
* @property string|null $keyword_list
|
||||||
* @property string|null $impact
|
* @property string|null $impact
|
||||||
* @property string $impact_level
|
* @property string $impact_level
|
||||||
* @property Carbon $published_at
|
* @property Carbon $published_at
|
||||||
@@ -56,6 +57,7 @@ class RssPost extends Model
|
|||||||
'entities',
|
'entities',
|
||||||
'metadata',
|
'metadata',
|
||||||
'bites',
|
'bites',
|
||||||
|
'keyword_list',
|
||||||
'impact',
|
'impact',
|
||||||
'impact_level',
|
'impact_level',
|
||||||
'published_at',
|
'published_at',
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public function up(): void
|
|||||||
$table->jsonb('keywords')->nullable();
|
$table->jsonb('keywords')->nullable();
|
||||||
$table->jsonb('entities')->nullable();
|
$table->jsonb('entities')->nullable();
|
||||||
$table->json('metadata')->nullable();
|
$table->json('metadata')->nullable();
|
||||||
|
$table->mediumText('keyword_list')->nullable();
|
||||||
$table->mediumText('bites')->nullable();
|
$table->mediumText('bites')->nullable();
|
||||||
$table->mediumText('impact')->nullable();
|
$table->mediumText('impact')->nullable();
|
||||||
$table->enum('impact_level', ['low', 'medium', 'high'])->default('low');
|
$table->enum('impact_level', ['low', 'medium', 'high'])->default('low');
|
||||||
|
|||||||
@@ -23,11 +23,11 @@
|
|||||||
|
|
||||||
Route::get('/disclaimer', [App\Http\Controllers\Front\FrontHomeController::class, 'disclaimer'])->name('front.disclaimer');
|
Route::get('/disclaimer', [App\Http\Controllers\Front\FrontHomeController::class, 'disclaimer'])->name('front.disclaimer');
|
||||||
|
|
||||||
Route::get('/latest', [App\Http\Controllers\Front\FrontListController::class, 'index'])->name('front.all');
|
Route::get('/bites', [App\Http\Controllers\Front\FrontListController::class, 'index'])->name('front.all');
|
||||||
|
|
||||||
Route::post('/search', [App\Http\Controllers\Front\FrontListController::class, 'search'])->name('front.search');
|
Route::post('/search', [App\Http\Controllers\Front\FrontListController::class, 'search'])->name('front.search');
|
||||||
|
|
||||||
Route::get('/search/{query}', [App\Http\Controllers\Front\FrontListController::class, 'searchResults'])->name('front.search.results');
|
Route::get('/bites/{query}', [App\Http\Controllers\Front\FrontListController::class, 'searchResults'])->name('front.search.results');
|
||||||
|
|
||||||
Route::get('/{category_slug}/{slug}', [App\Http\Controllers\Front\FrontPostController::class, 'index'])->name('front.post');
|
Route::get('/{category_slug}/{slug}', [App\Http\Controllers\Front\FrontPostController::class, 'index'])->name('front.post');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user