before query hook
before query hook