Random tweaks and extracted another function from search controller

Signed-off-by: emanuele <emanuele45@gmail.com>
Aggregate all the queris to insert data into log_search_results into a function

Signed-off-by: emanuele <emanuele45@gmail.com>