Update app
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
dvirlabs 2026-03-25 12:00:36 +02:00
parent 7b74c2a37d
commit 476089ecc6

View File

@ -39,9 +39,12 @@ app.get('/api/search', async (req, res) => {
return res.json([]);
}
// Escape special regex characters to allow literal search
const escapedQuery = query.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
// Search by family name (case-insensitive)
const matches = await Family.find({
family: { $regex: query, $options: 'i' }
family: { $regex: escapedQuery, $options: 'i' }
}).select('-__v -createdAt -updatedAt');
res.json(matches);