Update (keywords): new logic

This commit is contained in:
2023-11-23 02:15:41 +08:00
parent d2c2059531
commit b2762ecef2
15 changed files with 211 additions and 198 deletions

View File

@@ -25,7 +25,7 @@ public function home(Request $request)
// $query->whereNotIn('id', $featured_posts->pluck('id')->toArray());
// })->where('status', 'publish')->where('published_at', '<=', now())->orderBy('published_at', 'desc')->limit(10)->get();
$rss_posts = RssPost::where('status', 'published')->orderBy('published_at', 'desc')->paginate(15);
$rss_posts = RssPost::with('entities_keywords')->where('status', 'published')->orderBy('published_at', 'desc')->paginate(15);
return response(view('front.welcome', compact('rss_posts')), 200);
}

View File

@@ -40,7 +40,7 @@ public function searchResults(Request $request, $query)
SEOTools::jsonLd();
SEOTools::setTitle($title, false);
$rss_posts = RssPost::with('category')
$rss_posts = RssPost::with('category', 'entities_keywords')
->where('status', 'published')
->whereRaw("to_tsvector('english', title || ' ' || bites || ' ' || keyword_list) @@ plainto_tsquery('english', ?)", [trim(preg_replace('/\s+/', ' ', $query))])
->where('published_at', '<=', now())
@@ -81,7 +81,7 @@ public function index(Request $request)
SEOTools::jsonLd();
SEOTools::setTitle($title, false);
$rss_posts = RssPost::with('category')->where('status', 'published')
$rss_posts = RssPost::with('category', 'entities_keywords')->where('status', 'published')
->where('published_at', '<=', now())
->orderBy('published_at', 'desc')
->cursorPaginate(60) ?? collect();
@@ -128,7 +128,7 @@ public function category(Request $request, $category_slug)
SEOTools::jsonLd();
SEOTools::setTitle($title, false);
$rss_posts = RssPost::with('category')->where('status', 'published')
$rss_posts = RssPost::with('category', 'entities_keywords')->where('status', 'published')
->where('category_id', $category->id)
->where('published_at', '<=', now())
->orderBy('published_at', 'desc')

View File

@@ -25,13 +25,11 @@ public function prm(Request $request)
}
ParseRssPostMetadataTask::handle($id);
return 'ok';
}
public function crawlTask(Request $request)
{
$id = $request->input('id');
@@ -41,12 +39,11 @@ public function crawlTask(Request $request)
}
CrawlRssPostTask::handle($id);
return 'ok';
}
public function opml(Request $request)
{
$raw_posts = BrowseRSSLatestNewsTask::handleSingle('https://hnrss.org/newest?q=ai', 240);