-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Description
Hello!
I've been working on a benchmark for a while to compare the features and performance of Lucene and Tantivy, a rust search engine library which was heavily inspired by Lucene.
The benchmark uses the corpus and queries from luceneutil (the framework for Lucene nightly bench). Since not all query types are supported by Tantivy, currently it focuses on Term/Boolean/PhraseQuery. Tantivy in general showed performance advantages for now and I got motivated to understand why.
I documented the two engines' inverted index implementations per my understanding. Here is the wiki. Specifically, both engines use FST to aid the term lookup but the way they use them are quite different. In summary, Lucene uses FST to map term prefixes followed by scanning the on-disk blocks of terms. Tantivy uses FST to maps all the terms to their ordinals and use that ordinal/index to decode at most one full block.
The proposal here is to try Tantivy's term dictionary which I can see some advantages
- it can determine a term does not existing with only FST operations.
- decoding less terms in worst case (a term within a large gap between two prefixes)
- it is simpler? (might be subjective, but it took me days to digest Lucene90BlockTreeTermsWriter and I'm still not sure I got every bits correct...)
What do you think?