//===--- PostingList.h - Symbol identifiers storage interface --*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// /// /// \file /// This defines posting list interface: a storage for identifiers of symbols /// which can be characterized by a specific feature (such as fuzzy-find /// trigram, scope, type or any other Search Token). Posting lists can be /// traversed in order using an iterator and are values for inverted index, /// which maps search tokens to corresponding posting lists. /// /// In order to decrease size of Index in-memory representation, Variable Byte /// Encoding (VByte) is used for PostingLists compression. An overview of VByte /// algorithm can be found in "Introduction to Information Retrieval" book: /// https://nlp.stanford.edu/IR-book/html/htmledition/variable-byte-codes-1.html /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEX_POSTINGLIST_H #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEX_POSTINGLIST_H #include "Iterator.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/SmallVector.h" #include <cstdint> #include <vector> namespace clang { namespace clangd { namespace dex { class Token; /// NOTE: This is an implementation detail. /// /// Chunk is a fixed-width piece of PostingList which contains the first DocID /// in uncompressed format (Head) and delta-encoded Payload. It can be /// decompressed upon request. struct Chunk { … }; static_assert …; /// PostingList is the storage of DocIDs which can be inserted to the Query /// Tree as a leaf by constructing Iterator over the PostingList object. DocIDs /// are stored in underlying chunks. Compression saves memory at a small cost /// in access time, which is still fast enough in practice. class PostingList { … }; } // namespace dex } // namespace clangd } // namespace clang #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEX_POSTINGLIST_H