Back

Address Search (RÚIAN)

School Project
RustLeptosWebAssemblyDocker

Why I Built This

This project was developed as a final project for a database course in high school.

Goal

The goal was to build an address search engine for the Czech Republic on top of RÚIAN data. The application should respond in under 500ms per request, ideally under 60ms. It also needs to find every address in the country, including all edge cases.

Solution

I built a web application in Rust connected to MariaDB, using Leptos for the frontend and sqlx for the database layer.

The most complex part of the project was the database design. The key decision was to use a FULLTEXT INDEX on a dedicated helper column called search.

The resulting query looks like this:

SELECT <address>
FROM addresses
WHERE MATCH(search) AGAINST('+praha*' '+hlavn*' '+xxx138*' IN BOOLEAN MODE)
ORDER BY house_number = 138 DESC, orientation_number = 138 DESC
LIMIT 20;

All words and numbers are stripped of diacritics, and numbers are prefixed with xxx so they get picked up by the full-text search. For example, 138 becomes xxx138.

The ORDER BY clause ensures that addresses with an exact match for the number 138 rank higher than those that merely start with 138.