Vinay | Fix performance issue in search. Fix a few unit tests