WIP: CS-5432

First draft for optimizing backend search.

Please merge takeit's sql_optimize branch first.
shouldnt we allow minumum search word to be 1 ? Will make some problems when users will try to search only for example by: `a`