Mercadona has gotten rid of its search engine and replaced it with its own. They did it in a month with Claude Code and saved 90%

Mercadona’s online store processes 4.4 million searches a week. Until recently, that volume was managed Algoliaa well-established search service used by companies like Sephora or LVMH. They had been with him for eight years. Now They have replaced it with their own search enginebuilt largely by José Ramón Pérez Agüera, CTO of Mercadona Tech.

He has done it largely by himself, from his home, over a long weekend. This is how he told it in a successful LinkedIn post which now extends us in a video call with Xataka.

“I’m going to be very honest and I know that this is going to look tacky, but it’s the truth,” says Pérez Agüera. “70% of the work (implementing the search engine, improving search quality and laying the foundation) took three days. One weekend plus an extended Monday.”

The result: an 85% improvement in the quality of the ranking, the complete elimination of searches without results (previously 4% of the total) and a reduction in the monthly cost of between 9,000 and 15,000 dollars with Algolia to less than 900. That is, a saving of between 90% and 94% depending on the month.

A decision that had been on hold for years

The idea of ​​abandoning Algolia is not new at Mercadona Tech, it had been ruminating for a long time. The reasons are not surprising either: the search engine directly moves between 30 and 35% of the products that end up in the cart, which makes it a critical piece of business. And Algolia, like most SaaS services, has a pricing model that scales with use: as the company grows, the cost grows, with no way to stabilize it.

“In the end you end up in a vendor lock-in of very critical software that is then difficult to get rid of,” explains Pérez Agüera. But Every time the team considered building something of their own, the work estimate was pushed back.. “The most optimistic vision we had, and with a much more basic version than the one we are going to release now, was five months. And it already seemed fast to me.”

Then came the era of AI agents in software development. Pérez Agüera used Claude Code as the main tool and began to experiment on his own, without a formal project or assigned team. More out of curiosity than anything else. For playing.

What AI did and what it didn’t

The technical process combines hybrid search (by keywords and semantics) with a machine learning system that optimizes the ranking of results. AI made it possible to iterate on dozens of experiments in hours, analyze 479 MB of catalog and analytics data in days, and explore different ranking configurations by chatting with the agent instead of manually implementing them one by one.

“I easily did 40 or 50 experiments in a weekend. That would have traditionally taken me weeks,” he explains. But the speed has a precise limit: the 29 technical decisions that AI did not make.

mercadoonaaaa, mercaaadoooonaaaa (8)
mercadoonaaaa, mercaaadoooonaaaa (8)

Documentation generated during the experimentation process with Claude Code: the 14 parameters that Mercadona’s search engine evaluates to order results (from the popularity of a product to how well it fits semantically with what the user is looking for), its relative weight in the final ranking (popularity and semantic similarity account for two thirds of the decision) and the configuration of the machine learning model used to train it, based on click and purchase data from the last four weeks. Each of those parameters was discussed and validated with the AI ​​agent, but the final selection was made by the human team. Image provided by Mercadona Tech.

The most representative was the choice of the indexing engine. Most systems, and probably any AI agent consulted, would have recommended Elasticsearch, the most widespread solution. Pérez Agüera chose Tantivy, a much smaller library written in Rust that integrates as an embedded component, without the need for a separate Java virtual machine. An impossible decision without knowledge of the Mercadona ecosystem.

“The AI ​​always recommends the most generic option,” he says. “I made that decision because I have the context and the knowledge to make it.”

The transfer to the team

When the core of the search engine was ready, the project passed to the engineering team. What they found was not bad code, but it was ccode that did not follow Mercadona Tech’s internal standards. The architecture was hexagonal, as is the company’s style, but it used a different approach than usual.

The tests existed (Pérez Agüera applied TDD during development) but some did not make sense or were missing cases. The agent had written thousands of lines of code in a few hours and reviewing them all was unfeasible.

“The team’s Tech Lead took two or three days to adapt the project to our good practices,” he summarizes. “Not because the code was wrong, but because it didn’t meet our standards as a company.”

In total, adding the initial phase and the launch into production, which includes load testing, infrastructure adjustment and integration into the Mercadona Online architecture; The project has taken approximately a month of work. And “two and a half people” have been in charge of it: Pérez Agüera, the Tech Lead of the Shop team and a part-time Staff Engineer for infrastructure. The original five-month estimate required five or six people.

FWe have easily done a x5 to the speed of the projectand what we have now is much more advanced than what we would have had in five months,” he says.

What changes for the teams

For Pérez Agüera, the search engine is one more experiment within a larger transformation that Mercadona Tech continues to process internally. The question on the table is not whether to use AI in development, but how to redesign the entire development process based on it.

His diagnosis of the profiles is forceful: “AI is going to mean that fewer developers are needed and more engineers are needed. Coding loses value per se; the criteria, the structural vision, the systems vision gain value”. What AI is coming to replace, he says, is what his colleague Emilio Carrión, Staff Engineer, half-jokingly, half-seriously calls “glorified typing.”: writing code as a craft and manual task.

Regarding limits, their position is very clear: there are no limits by type of project. “Any security audit done with AI is going to come out better. Any analysis on the robustness of a payment system, on the corner casesAI is going to give you much more completeness.” What is needed, he says, are guardrails: not generic rules, but real blockades that prevent the agent from skipping steps or making decisions that require human judgment.

That is precisely the next layer that the team is working on: moving from vibe coding, the equivalent of chatting with a language model, to specification-driven development.

The idea is that before writing a line of code, the system generates a sufficiently complete and robust specification on which the agent can work with guarantees. They are testing frameworks such as GSD, Superpowers and Open Spec with that objective.

“For a company like Mercadona, which places 25,000 orders a day, if the software fails you lose a lot of money. It is not an MVP (minimum viable product) of a startup,” says Pérez Agüera. “Speed ​​without direction takes you quickly to a place that was not where you wanted.”

In Xataka | The fever for Mercadona’s prepared food is such that it is eating up a business that until now was untouchable: McDonald’s

Featured image | Mercadona, Mercadona Tech, Xataka with Mockuuups Studio

Leave your vote

Leave a Comment

GIPHY App Key not set. Please check settings

Log In

Forgot password?

Forgot password?

Enter your account data and we will send you a link to reset your password.

Your password reset link appears to be invalid or expired.

Log in

Privacy Policy

Add to Collection

No Collections

Here you'll find all collections you've created before.