Get actual data for autocomplete, and called functions for different types of queries