Lucene's In-memory Terms Dictionary, Thanks to Google Summer of Code
Join the DZone community and get the full member experience.Join For Free
Jiang's Google Summer of Code project
big success: he created a new (now, default) postings format
for substantially faster searches, along with smaller indices.
This summer, Han was at it again, with a new Google Summer of Code project with Lucene: he created a new terms dictionary holding all terms and their metadata in memory as an FST.
In fact, he created two new terms dictionary implementations. The first,
FSTTermsWriter/Reader, hold all terms and metadata
in a single in-memory FST, while the second,
FSTOrdTermsWriter/Reader, does the same but also supports
retrieving the ordinal for a term (
looking up a term given its ordinal (
ord)). The second one also uses this
internally so that the FST is more compact, while all metadata is
stored outside of the FST, referenced by
Like the default
BlockTree terms dictionary, these new
terms dictionaries accept any
PostingsBaseFormat so you
can separately plug in whichever format you want to encode/decode the
Han also improved the
PostingsBaseFormat API so that
there is now a cleaner separation of how terms and their metadata are
encoded, as opposed to how postings are encoded;
PostingsReaderBase.decodeTerm now handle encoding and
decoding any term metadata required by the postings format,
abstracting away how the long/byte were persisted by the terms
dictionary. Previously, this line was annoyingly blurry.
Unfortunately, while the performance for primary key lookups is substantially faster, other queries like
WildcardQuery are slower; see
for details. Fortunately, using
you are free to pick and choose which fields (e.g., your "id" field)
should use the new terms dictionary.
For now, this feature is trunk-only (eventually Lucene 5.0).
Thank you, Han, and thank you, Google!
Published at DZone with permission of Michael Mccandless, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Observability Architecture: Financial Payments Introduction
Competing Consumers With Spring Boot and Hazelcast
Effortlessly Streamlining Test-Driven Development and CI Testing for Kafka Developers
RBAC With API Gateway and Open Policy Agent (OPA)