js logic for solgs search autocomplete