optimized course search query