prepare script for relevance query