optimize search module query