librariesio / libraries.io

:books: The Open Source Discovery Service
https://libraries.io
GNU Affero General Public License v3.0
1.1k stars 204 forks source link

SearchController#index: short-circuit when no search term is provided #3209

Closed mpace965 closed 9 months ago

mpace965 commented 9 months ago

This prevents expensive elasticsearch queries that have been the target of scraping efforts.

Screenshot 2023-09-22 at 11 35 42 AM

loganlifts commented 9 months ago

No concerns with shipping this approach, but I'm curious, should we also prevent the UI from doing anything at all if a search term isn't provided into the input? It seems reasonable to me to just not allow the search button / form submission to work.