add beforeSearch event