how to set up a quary factory

how to set up a quary factory