Improve video search results by adding debug logging

Enhance the video search functionality in `VideoPage.tsx` by adding console logs to track search query matches against video titles and descriptions, and update the UI to display the number of videos found for a given search query.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: d7424866-83d1-4486-a212-ac12b4c7becf
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/d7424866-83d1-4486-a212-ac12b4c7becf/tUbKYxk
This commit is contained in:
sebastjanartic 2025-08-28 17:10:40 +00:00
parent 789e428d16
commit b92d7324ac

View File

@ -75,8 +75,15 @@ export default function VideoPage() {
.filter(video => {
if (!sidebarSearchQuery || sidebarSearchQuery.length < 2) return true;
const searchLower = sidebarSearchQuery.toLowerCase();
return video.title.toLowerCase().includes(searchLower) ||
video.description?.toLowerCase().includes(searchLower);
const titleMatch = video.title?.toLowerCase().includes(searchLower);
const descMatch = video.description?.toLowerCase().includes(searchLower);
// Debug logging
if (sidebarSearchQuery.length >= 2) {
console.log(`Search "${sidebarSearchQuery}": Video "${video.title}" - Title match: ${titleMatch}, Desc match: ${descMatch}`);
}
return titleMatch || descMatch;
});
@ -362,9 +369,18 @@ export default function VideoPage() {
<Search className="w-12 h-12 mx-auto mb-2 opacity-50" />
<p>No videos found for "{sidebarSearchQuery}"</p>
<p className="text-xs mt-1">Try different keywords</p>
<p className="text-xs mt-1 opacity-75">
Searched {(recommendedResponse?.videos || []).length} videos
</p>
</div>
) : (
filteredRecommendedVideos.slice(0, 10).map((video) => (
) : sidebarSearchQuery.length >= 2 ? (
<div className="mb-2 text-xs text-bunny-muted">
Found {filteredRecommendedVideos.length} videos
</div>
) : null}
{filteredRecommendedVideos.slice(0, 10).map((video) => (
<div
key={video.id}
onClick={() => window.location.href = `/video/${video.id}`}
@ -410,8 +426,7 @@ export default function VideoPage() {
</div>
</div>
</div>
))
)}
))}
</div>
</div>
</div>