Whats the difference between .find() and .search()

And whats the _q field on ctx.query?

find function is used when you know exactly in what columns you should make the search and you specify the column name in parameters, for example:
https://127.0.0.1:1337/articles?title=Best
In that case, you defined the field title with value Best, so it will search in DB only in that field.


search function is used when you want to search in ALL textual columns, for this you add _q to the parameters, for example:
https://127.0.0.1:1337/articles?_q=Best
In that case, you didn’t define the column name, so it will execute the search function instead of find. That way you will search in ALL columns for “Best” string.

1 Like

I’ll adjust the wording here for search, it will search ALL columns ALL textual columns in the full-text index.

2 Likes

What if we have both like
https://localhost:1337/articles?title=best&_q=ind

Can I use search?
like:
strapi.services.articles.search({ title: 'best', _q='ind'});
Or please suggest a better option.