E
E
Egor Petrov2015-04-01 10:48:09
PostgreSQL
Egor Petrov, 2015-04-01 10:48:09

In which direction should we move to implement the implementation of address autocompletion according to FIAS data?

Good afternoon, I'm trying to implement an autocomplete for an address like this: https://dadata.ru/suggestions/ according to fias data.
At the moment, tables from the fias are simply transferred and indexes are built, foreign keys are added between streets-cities-districts-regions. The database structure has not changed.
At the moment, the search is carried out by successively indicating the region, city, street, house.
But I would like to be able to enter the string "altai pavlovs lenin" in the address bar and get lenin street in the village of pavlovsk in the Altai Territory, and a number of less suitable options.
If you search for something from the database for each word, build a chain up to the level of the region, and then look at how many suitable words are in the chain, then there will not be enough operatives. If you do the same in batches, it will take an unreasonably long time. If you implement this through joins, then I'm not sure that this is a good option and so far I have a hard idea how this can be done, because the number of levels in the address may vary. But if this is the best option, I'll figure it out.
Can anyone point me in which direction to go when solving this issue?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Egor Petrov, 2015-04-04
@Hayate

It looks like the tags in tsvector and gin index are saving the father of Russian democracy. 20ms to find the right address.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question