Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

The first big change in flexible indexing is the consumption of the postings enumerators APIs:

  • Wiki Markup
    A term is now an arbitrary {{byte\[\]}}, represented by a {{BytesRef}} (which references an offset + length "slice" into an existing {{byte\[\]}}).  By default terms will be UTF8 encoded character string, created during indexing, but your analysis chain can produce a term that is not UTF8 bytes.
    \\

  • Fields are separately enumerated (via FieldsEnum) from term text. Consumers of the flex API no longer need to check Term.field() on each .next() call; instead, they obtain a TermsEnum for the specific field they need and iterate it until exhaustion.
  • TermsEnum iterates and seeks to all terms (returned as BytesRef) in the index. A TermsEnum is optionally able to seek to the ordinal (long) for the term, and return the ordinal for the current term. SegmentReader implements this but MultiReader does not because working with ords is far too costly (requires merging).
  • Deleted documents are no longer implicitly filtered by DocsEnum (previously TermDocs). Instead, you provide an arbitrary skipDocs bit set (Bits) stating which documents should be skipped during enumeration. For example, this could be used with a cached filter to enforce your own deletions. IndexReader.getDeletedDocs returns a Bits for the current deleted docs of this reader.
  • Seeking to a term is no longer done by the docs/positions enums; instead, you must use TermsEnum.seek and then TermsEnum.docs or .docsAndPositions to obtain the enumerator (there are also sugar APIs to accomplish this). TermsEnum's seek method has three return values: FOUND (the exact term matched), NOT_FOUND (another term matched) and END (you seek'd past the end of the enum).
  • Composite readers (currently MultiReader or DirectoryReader) are not able to provide these postings enumerators directly; instead, one must use the static methods on MultiFields to obtain the enumerators.

...