lucene query tests + bug fixing