UniSierra Eats search is fully client-side. When a student types a term into the navigation bar and presses Enter or clicks the search button, the browser navigates toDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/JuseAR27/Unisierra-eats/llms.txt
Use this file to discover all available pages before exploring further.
busqueda.html with the query encoded in the URL. The search page then fetches the complete product list from GET /api/productos and filters it in memory using JavaScript — no dedicated search endpoint is needed.
How Search Works
- The search bar in the navigation calls
configurarBuscadorGlobal()on page load. - When the student submits a query, the browser navigates to
busqueda.html?q=<encoded term>. renderizarBusqueda()reads theqandcategoriaparameters fromwindow.location.search.- All products are fetched from the API via
obtenerProductosAPI(). - The product list is filtered in memory against the query term and/or category.
- Matching products are rendered as result cards; a “not found” message is shown if the array is empty.
Triggering a Search
The global search bar is wired inconfigurarBuscadorGlobal():
ejecutarBusqueda(). Empty queries are ignored — the browser only navigates when the trimmed input is non-empty.
Filter Logic
After products are fetched, therenderizarBusqueda() function applies the text filter. Matching is case-insensitive and checks three fields: product name, description, and category.
categoria query parameter is also present, a second filter pass is applied immediately after:
q and categoria can be combined in a single URL — for example busqueda.html?q=pollo&categoria=sanas returns only healthy products whose name, description, or category also contains “pollo”.
URL Query Parameters
| Parameter | Type | Description |
|---|---|---|
q | String | Free-text search term, URL-encoded |
categoria | String | Category slug: comidas, bebidas, snacks, or sanas |
Browsable Categories
The four category slugs that can be passed to?categoria= are:
| Slug | Description |
|---|---|
comidas | Main cooked dishes |
bebidas | Hot and cold drinks |
snacks | Light bites and quick snacks |
sanas | Salads and healthy options |
Search Result Cards
Each product that matches the query is rendered as a result card byrenderizarBusqueda(). The card includes:
- Product image (clickable, navigates to
detalle_producto.html?id=<id>) - Product name (also clickable)
- Star rating rendered by
generarEstrellas()with numeric score and review count - Price tier tag (
$or$$, computed client-side fromprecio) - Category tag labelled “Cafetería”
- Description snippet — first 100 characters of
descripcion
Search on the Menu Page
The menu page (menu.html) supports the same ?q= filtering via the renderizarMenu() function. It reads the q parameter from the URL and applies the identical three-field filter:
Resultados de búsqueda: "<term>" depending on whether a query is active.
The
?categoria= parameter is supported only on busqueda.html. The menu page (menu.html) reads only the ?q= parameter and does not apply a category filter pass.Search Page vs. Menu Page
| Feature | busqueda.html | menu.html |
|---|---|---|
Supports ?q= | Yes | Yes |
Supports ?categoria= | Yes | No |
| Card layout | Image + details cards | Text list with prices |
| Star ratings shown | Yes | No |
| Navigates to detail page | Yes (click image or name) | Yes (click name) |