Skip to content

Commit add827b

Browse files
sirjamesgrayclaude
andcommitted
fix: Remove excessive logging from user search
Cleaned up verbose console.log statements while keeping the core comprehensive search logic with substring matching. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b73d628 commit add827b

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

app/api/search-unified/route.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -607,8 +607,6 @@ async function searchUsersComprehensive(searchTerm, maxResults = 20) {
607607
const searchLower = searchTerm.toLowerCase().trim();
608608
const results = new Map();
609609

610-
console.log(`🔍 [USER SEARCH] Searching for users with term: "${searchTerm}" (lowercase: "${searchLower}")`);
611-
612610
// ALWAYS do a comprehensive search since we don't have many users
613611
// This is more reliable than trying to use the usernameLower field which may not be populated
614612
try {
@@ -618,30 +616,22 @@ async function searchUsersComprehensive(searchTerm, maxResults = 20) {
618616
);
619617
const broadResults = await getDocs(broadQuery);
620618

621-
console.log(`🔍 [USER SEARCH] Fetched ${broadResults.size} user documents for filtering`);
622-
623619
broadResults.forEach(doc => {
624620
const userData = doc.data();
625621
const username = userData.username || '';
626622
const usernameLower = (userData.usernameLower || username).toLowerCase();
627623

628-
console.log(`🔍 [USER SEARCH] Checking user ${doc.id}: username="${username}", usernameLower="${usernameLower}"`);
629-
630624
// SECURITY: Only include users with valid usernames, never search by email
631625
if (!username || username.includes('@') || username === 'Anonymous' || username.toLowerCase().includes('missing')) {
632-
console.log(`🔍 [USER SEARCH] Skipping user ${doc.id} - invalid username`);
633626
return; // Skip users without proper usernames
634627
}
635628

636629
// Search by username using case-insensitive substring matching
637630
// This catches "Jumbo" in "JumboJubilee"
638631
const usernameMatch = usernameLower.includes(searchLower);
639632

640-
console.log(`🔍 [USER SEARCH] User ${doc.id} match check: "${usernameLower}".includes("${searchLower}") = ${usernameMatch}`);
641-
642633
if (usernameMatch) {
643634
const matchScore = calculateSearchScore(username, searchTerm, true, false);
644-
console.log(`🔍 [USER SEARCH] ✓ Found match! User ${doc.id} (${username}) with score ${matchScore}`);
645635
results.set(doc.id, {
646636
id: doc.id,
647637
username,
@@ -652,8 +642,6 @@ async function searchUsersComprehensive(searchTerm, maxResults = 20) {
652642
});
653643
}
654644
});
655-
656-
console.log(`🔍 [USER SEARCH] Found ${results.size} matching users`);
657645
} catch (error) {
658646
console.error('Error in comprehensive user search:', error);
659647
}

0 commit comments

Comments
 (0)