first implementation of js search