So I decided to keep the way it was done in the Lucene implementation as it's indeed pretty clever and efficient.