fix lucene query and exclude document templates