AutosTREFA/trefa-mariana-qwen3-14b
This new version of Mariana has enhanced
What was implemented in this new version:
- Database RPC function (buscarvehiculosfuzzy) on the mhlztgilrmgebkyqowxz Supabase project:
- Uses busqueda_tsv (tsvector with Spanish stemming) for full-text search
- Uses pg_trgm similarity on individual words against marca and modelo columns
- Combined relevance score: tsrank * 2 + titulosimilarity + bestperword_similarity
- Accepts the same numeric filters (price, year, km) as the primary query
- Threshold: 0.2 per-word similarity (catches "jeta"→"Jetta", "nisan"→"Nissan", etc.)
- buscarVehiculos.ts — transparent fallback (lines 123-153):
- The primary ILIKE query runs first (unchanged behavior)
- If 0 results, builds a search text from marca + modelo + tipo_carroceria + motor
- Calls buscarvehiculosfuzzy via .rpc() with the same price/year/km filters
- Returns results with busqueda_aproximada: true and a correction note
- The model never needs to know about this — it calls buscar_vehiculos the same way
- Search cascade (3 layers of typo tolerance):
- Static maps (fuzzy.ts) — instant lookup for known misspellings
- Levenshtein (fuzzy.ts) — catches typos within edit distance 2 against live inventory
- tsvector + trigram (new) — catches everything else via database-level fuzzy matching
Test results:
┌───────────────────┬──────────────────────────────────────────────────────────┐ │ Query │ Result │ ├───────────────────┼──────────────────────────────────────────────────────────┤ │ "nisan sentra" │ Nissan Sentra SR CVT (relevancia: 1.09) │ ├───────────────────┼──────────────────────────────────────────────────────────┤ │ "hundai tuczon" │ Hyundai Tucson Limited Tech (0.74) │ ├───────────────────┼──────────────────────────────────────────────────────────┤ │ "jeta automatico" │ Volkswagen Jetta Sportline (0.33) │ ├───────────────────┼──────────────────────────────────────────────────────────┤ │ "chevi equinocs" │ Chevrolet Tracker/Onix/Aveo (0.44) — no Equinox in stock │ ├───────────────────┼──────────────────────────────────────────────────────────┤ │ "toyoda camri" │ Toyota Prius/Corolla (0.43) — no Camry in stock │ └───────────────────┴──────────────────────────────────────────────────────────┘
