Cache frozen FieldType to skip schema validation (#15886) When indexing, every field in every document has its schema built via updateDocFieldSchema and validated via assertSameSchema against the existing FieldInfo. For the common case where a field consistently uses the same frozen FieldType instance, this work is redundant — a frozen type is immutable, so its schema contribution is identical every time. This change caches the frozen FieldType on each PerField and checks same object instance to detect when the type hasn't changed. When it matches, schema building and validation are skipped entirely, and FieldSchema only resets its docID. If a different type is encountered, the cache is invalidated and the full validation path runs. A deoptimize path handles multi-valued fields where a later value uses a different type than earlier values within the same document. Adds FieldType.isFrozen() to support the optimization, and new tests covering the fast-path, cache invalidation, deoptimize, cross-segment validation, and document blocks.

Apache Lucene is a high-performance, full-featured text search engine library written in Java.
This README file only contains basic setup instructions. For more comprehensive documentation, visit:
gradlew).We‘ll assume that you know how to get and set up the JDK - if you don’t, then we suggest starting at https://jdk.java.net/ and learning more about Java, before returning to this README.
Bug fixes, improvements and new features are always welcome! Please review the Contributing to Lucene Guide for information on contributing.
#lucene and #lucene-dev on freenode.net