D
D
Demetrio952014-11-04 16:48:57
Qt
Demetrio95, 2014-11-04 16:48:57

How to optimize the number of requests to the site api?

Hello, I'm working on a project: Database Anime
The program has the ability to get information by the name of the anime.
To begin with, when you enter a name in the field, when you enter each new character (field edit signal), a request is sent for a new piece of data and the names are set in the QCompleter model.
I would like to optimize the work of the search function so that as few requests as possible are sent to the api of the site from which the information is obtained.
Tell me possible solutions and in which direction to look for solutions, and possibly materials on this topic.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
X
xmoonlight, 2014-11-04
@xmoonlight

trigrams (+local user knowledge: query history)

D
Demetrio95, 2014-11-04
@Demetrio95

I read about trigrams, to be honest, I don’t think that they are needed for my task, although they can probably be used and it will turn out even better than my solution, but much more complicated.
I solved it simply:
QStringList animelist = _titleCompliterModel.stringList();
foreach (QString name, animelist) {
if ( name.toUpper().contains( title.toUpper() ) )
return;
}
api.searchAnime( title );
it helps, I don’t know, maybe jambs will come out later with this method.
I'd be happy to hear if there are better solutions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question