Can you do RAG with Full Text Search in MariaDB?

Lorenzo Cremonese

We continue our blog series on learning more about users of MariaDB. Searching LinkedIn for posts about MariaDB this morning we saw an impressive confident post about using MariaDB in a RAG solution named SemantiQ. We got curious about it and reached out to the author Lorenzo Cremonese to have a chat.

Lorenzo’s post on LinkedIn

Tell us about yourself Lorenzo! 

I’m an Italian studying in Spain. I began programming when I was 14, and I’m now 22. I’m a self-taught web developer since 3-4 years ago, and I’m now doing a two year University education in Spain focused on web development at the institute IES ENRIC VALOR, in Pego. 

So what is SemantiQ? 

SemantiQ was my final project for the term. I had noticed a lot of talk about RAG and GenAI (before MCP started trending) and decided to do a project about it. None of my course friends were doing it, but I thought “Let’s give it a go!”. 

I’m very happy with the results of the past two months, that I have been working on in the evenings after my day time internship. I was a lot of fun – I’m curious and it’s fun to discover new things. I have learnt HTML, CSS, and javascript by myself, and now RAG and AI integrations too. 

Where can I see the project?

The project is available on github at https://github.com/looreenz/SemantiQ-AI. The project is not publicly deployed to try out, but I’ll give you a demo of my project: 

  1. To prepare the data, the user can upload PDFs and txt files. The backend “chunks” the content to 100 character pieces and saves them in MariaDB. The chunks are full-text indexed for search.
  1. When a question is stated, the closest five text chunks to the question are searched for in MariaDB. The chunks  are given as context when the question is sent to the LLM API. The LLM then answers the question based on the given context chunks. 

The app also shows the history of chats, and statistics on various data in the system. 

So you are using MATCH AGAINST instead of Vectors? 

I implemented the search using full-text search with MariaDB’s MATCH AGAINST to compare the question with chunks. 

Does that work for RAG?

It works well enough for this use case example with a simple prompt, but I have looked at how to use vectors too and I might implement it later. It would make the search results more semantic and versatile. 

After talking with Lorenzo, I asked Sergei Golubchik‘s opinion (who wrote what is now MariaDB Full-text Search decades prior to writing the Vector indexing), and he agrees with the approach: 

Sure, it makes sense. One can use vector search or full-text search to select relevant documents for RAG. Or one can use both – it’s called Hybrid Search and combine ranking from two different search algorithms using reranking, for example Reciprocal Rank Fusion. See, https://learn.microsoft.com/en-us/azure/search/hybrid-search-ranking

Lorenzo, tell me about the tech stack: Laravel, MariaDB, React, Bootstrap, OpenAI and Docker in the post. Why MariaDB?

We had recently been using MariaDB on the uni courses, so it was easy to choose a technology that was fresh in memory. We have also studied other databases, but felt most confident with MariaBD at the moment. It is easy to set up a MariaDB database with Docker –  Laravel then provides a clean interface to MariaDB, and the React frontend can access MariaDB nicely through Laravel. In this project I only needed an OpenAI Large Language Model, not an embedding model.  

What databases are used in Spain? 

A lot of academic courses teach both MariaDB and PostgreSQL – I’d say it is a draw between them in academic settings. I don’t know how it is in professional use in Spain. I will start working at a startup on Monday, so I’ll learn more about how it is in practice. 

What startup will you be working for? 

I’ll start working for huming.pro – it’s a platform that connects artists and places to perform. For example for artists it suggests places to perform based on their genre. My objective is to grow and learn – at startups or bigger companies too.  In October I’ll also begin a one-year Master’s program in cybersecurity while working at the startup.

Cool! I wish you the best of luck, and thank you for sharing some practical insights about your project and MariaDB! 

Call to Action: Be bold and experiment!

This blog described an exploratory, truly novel way of creating a RAG. For a standard, but still bleeding edge approach with vectors, fork the GitHub repository https://github.com/abramovd/yt-semantic-search as documented in Youtube Semantic Search is the winner of MariaDB AI RAG Hackathon innovation track from May 2025 – and play around with your own ideas.