Move `setSearchPat` operation from cpp to script for lua-tests