elasticsearch/elasticsearch — pull request #8435 by dakrone (2014-11-11 12:02:18+00:00)
Title: Refactor term analysis for simple_query_string prefix queries

Also fixes an issue where the token stream could be non-closed if an
exception occured.

I used `org.apache.lucene.util.QueryBuilder` as a template for refactoring this.