[bugfix] Fix memory leak in lucene-based query functions (full-text and range index).