C
C
coderisimo2015-10-15 13:27:14
MySQL
coderisimo, 2015-10-15 13:27:14

How to do a quick MySQL full text search for an autocomplete field?

There is a table with 200k + records. A quick search on two fields is required: tags and titles.
Search for autocomplete. That is, two characters are entered and all headings where there is this combination of letters and all headings in the tags of which there is this combination of letters should be loaded into the list.
I read about the possibilities of fast work, if you load data (only headers, tags and record IDs) to the client in advance and search without accessing the database. In that case, everything worked fine with 10,000 elements. There is a suspicion that 200.000 is a slightly different situation. It is clear that using the default autocomplete from JQuery here will give brakes, even if you implement caching on the client and reduce the delay in the settings for this autocomplete.
I have heard about Sphinx, but have not dealt with it and am not sure that this tool will be suitable here.

As always, I'd be grateful for ideas.

Thanks

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Puma Thailand, 2015-10-15
@coderisimo

the sphinx here will just be in the subject and quickly.

V
Vladimir Io, 2015-10-15
@vawsan

Websocket will be fast, but if you don't have it in your project, it's not a fact that it's rational.
Giving 200k to the client is not an option, it will collapse on most computers.
And so, the first thing that comes to mind is ajax blocking all requests except the last one. That is, they entered 1 character - the request went, but if the second character was already entered before the response was received or the first one changed, we interrupt the first operation, and the second went.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question