An Algorithmic Framework for Hybrid Retrieval and LLM-Based Filtering in Pharmaceutical Semantic Catalogue Search
Pharmaceutical wholesalers manage vast catalogues spanning dozens of distributors and heterogeneous nomenclatures, where Customer Service Representatives (CSRs) in call centers must identify products from semantically ambiguous natural language queries, a task at which keyword-based retrieval underperforms. This paper presents the algorithmic design and production evaluation of an intelligent product catalogue assistant deployed at Bidafarma, a Spanish pharmaceutical wholesaler. The system implements a three-path query routing algorithm and an enhanced six-stage search flow algorithm that combine Elasticsearch’s multi-field retrieval with Large Language Model (LLM)-Based Filtering across three product categories and more than 30 distributors. Its central design principle is selective LLM invocation: the Routing Classifier bypasses the LLM for product ID and product name queries, reserving it for the semantically complex path. Additionally, we introduce an indexing mechanism for false positives, based on Hierarchical Navigable Small World approximate nearest-neighbor search, that incrementally updates from CSR feedback and provides continuous precision improvement without model retraining. Evaluated on 14,997 production queries gathered between November 2024 and July 2026, the system achieves 99% accuracy and an average end-to-end response time of 2.57 s, with 99% of queries served within a 15 s operational threshold (p95 = 7.4 s). A component-level analysis shows that the routing policy, which invokes the LLM on only 35% of queries, is the principal driver of this low latency, and that the LLM-Based Filtering removes 24% of the lexical-retrieval candidates. These results validate the proposed algorithmic framework as an effective and low-latency solution for semantic product search in knowledge-intensive business-to-business service operations.
Authors
- Manuel A. Sánchez-Montañés (ORCID: https://orcid.org/0000-0002-5944-0532)
- Francisco Nanclares
- Antonio Cernadas
- Ignacio Gutiérrez-Peña
Institutions
- Universidad Autónoma de Madrid (ES)
Publication Details
- Journal
- Algorithms
- Published
- 2026-11-09
- DOI
- https://doi.org/10.3390/a19110977
- Primary Topic
- Information Retrieval and Search Behavior
- Type
- article
- Field-Weighted Citation Impact
- 0.00