refactor the large if-elif-else used for searching
added search-hook for plugins using "search" scope