Commit Graph
3879 Commits
Author SHA1 Message Date
dependabot[bot] b2577292f4 Bump github/codeql-action/upload-sarif from 4.36.1 to 4.39.5
Bumps [github/codeql-action/upload-sarif](https://github.com/github/codeql-action) from 4.36.1 to 4.39.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/87557b9c84dde89fdd9b10e88954ac2f4248e463...915412ff23e8b7659517e607487dbeae018f2934)

---
updated-dependencies:
- dependency-name: github/codeql-action/upload-sarif
  dependency-version: 4.39.5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-26 20:02:37 +00:00
Paul MasurelandPaul Masurel 9b91b2993e Cargo fmt (#3295)
Co-authored-by: Paul Masurel <paul.masurel@datadoghq.com>
2026-11-26 17:55:28 +01:00
Paul MasurelandPaul Masurel dae3ca812c Optimize OnPair16 plain block open and value decoding (#3285)
- Decode the dictionary once per block open into one DictEntry
  { start: u16, len: u16 } per token, instead of an offsets Vec checked
  by validate_safety. DictEntry is repr(C, align(4)), with the layout of
  a u32, checked by compile-time asserts. The reader enforces
  MAX_CODE_BITS = 12, so token starts fit on 16 bits, and only the last
  token's read padding is checked. The token lengths are decoded 16 at a
  time with NEON (aarch64) or SSE2 (x86_64), which store the interleaved
  (start, len) u16 lanes directly as DictEntry values, with a scalar loop
  for the rest and for other targets.
- Decode values in a single pass: 4 codes per u64 load, one range check
  per 4 codes, and a 16-byte over-copy per token, in chunks of 256 codes
  so that reserve stays bounded. This drops onpair's decoded_len pre-pass
  and the codes_buffer round trip. The code load (load_codes) and the
  token copy (copy_token) are inline functions taking slices, with their
  safety contracts checked by debug_assert.
- Remove the now unused codes_buffer parameter of append_value, and the
  PlainValueReader field.
- Keep a single OwnedBytes in OnPair16Block instead of splitting it.
- Test write_codes against load_codes, the reader's code load, for
  code_bits in 1..=12, instead of against BitUnpacker.

Co-authored-by: Paul Masurel <paul.masurel@datadoghq.com>
2026-11-26 12:10:42 +01:00
Paul MasurelandPaul Masurel 605f7e9890 Use BlockwiseLinearCodec directly for plain block offsets (#3289)
* Use BlockwiseLinearCodec directly for plain block offsets

- Store BlockwiseLinearReader directly in OnPair16Block and RawBlock
  instead of Arc<dyn ColumnValues<u32>>, dropping the 1-byte CodecType
  prefix (block kind and column format version cover future format changes).
- Skip the redundant BlockwiseLinearEstimator estimation pass on write.
- Add BlockwiseLinearReader::get_pair(slot) (sharing the block lookup for
  511/512 consecutive pairs) and avoid bytes.split in BlockwiseLinearCodec::load.
- Keep a single OwnedBytes in RawBlock and update LAYOUT.md.

* Serialize plain block offsets without stats or estimation pass

---------

Co-authored-by: Paul Masurel <paul.masurel@datadoghq.com>
2026-11-25 15:38:33 +01:00
Paul MasurelandPaul Masurel 13edc66706 Add ColumnValues::get_pair and use it for multivalued offsets (#3288)
- Add get_pair(&self, idx: u32) -> (T, T) to ColumnValues<T> with a
  default implementation and forward it through Arc<dyn ColumnValues<T>>
  and MonotonicMappingColumn.
- Implement BlockwiseLinearReader::get_pair to share the block lookup
  when idx and idx + 1 fall in the same 512-element block.
- Use get_pair in MultiValueIndex (V1/V2 range and V1 iter_non_null_docs)
  and plain block offset lookups.
- Add unit test covering within-block and block-boundary pairs via
  Arc<dyn ColumnValues<u32>>.

Co-authored-by: Paul Masurel <paul.masurel@datadoghq.com>
2026-11-25 14:18:22 +01:00
Paul Masurel a0f6ad1038 Add plain block benchmark (bench_plain_block) (#3286) 2026-11-25 12:07:08 +01:00
Pascal Seitz 0390f89fb8 Format src/termdict/mod.rs with nightly rustfmt 2026-11-24 16:31:36 +01:00
Pascal Seitz 9491fc670b Fix typo postinglist_metdata -> postinglist_metadata 2026-11-24 16:31:36 +01:00
Pascal Seitz d8c8eec0d8 Remove trailing doc_freqs EOF check in create_bitset_for_automaton 2026-11-24 16:31:36 +01:00
Pascal Seitz ac7bafc11e Remove u64 tag from FileHandle::stream_ranges 2026-11-24 16:31:36 +01:00
Pascal Seitz 86e2432352 Run automaton candidate block selection and bitset allocation on CPU executor 2026-11-24 16:31:36 +01:00
Pascal Seitz 9694ab733a Allocate automaton bitset on CPU executor 2026-11-24 16:31:36 +01:00
Pascal Seitz ae8a08c067 Handle empty v2 SSTable index in get_block_for_automaton 2026-11-24 16:31:36 +01:00
Pascal Seitz afa7a65b42 Simplify automaton block batching and bitset assertions 2026-11-24 16:31:36 +01:00
Pascal Seitz 2c7e8b9bdf Consolidate automaton bitset tests and simplify the nested slice test 2026-11-24 16:31:36 +01:00
Pascal Seitz 7cae188ae0 Simplify postings decoding and automaton bitset tests 2026-11-24 16:31:36 +01:00
Pascal Seitz 2fe6a51992 Clarify byte buffer names in automaton bitset construction 2026-11-24 16:31:36 +01:00
Pascal Seitz 91ea4f26e4 Carry term metadata through streamed range reads and simplify bitset batching 2026-11-24 16:31:36 +01:00
Pascal Seitz 820d5d9b34 Stream dictionary blocks with their ordinals and collect posting list metadata 2026-11-24 16:31:36 +01:00
Pascal Seitz 9e2ee2f56f Clarify the byte target per CPU task in automaton bitset construction 2026-11-24 16:31:36 +01:00
Pascal Seitz 0633ec8f41 Forward streamed ranges with the file slice offset 2026-11-24 16:31:36 +01:00
Pascal Seitz a16faee086 Name streamed ranges and candidate dictionary blocks 2026-11-24 16:31:36 +01:00
Pascal Seitz 096893e98d Stream dictionary blocks when building automaton bitsets 2026-11-24 16:31:36 +01:00
Pascal Seitz a5013667d8 Default batch streams to sequential async range reads 2026-11-24 16:31:36 +01:00
Pascal Seitz a373513ee6 Consolidate automaton bitset construction and streaming tests 2026-11-24 16:31:36 +01:00
Pascal Seitz 5b59e3b48a Stream exact posting ranges as a single batch 2026-11-24 16:31:36 +01:00
Pascal Seitz d0e21f2291 Batch automaton postings decoding 2026-11-24 16:31:36 +01:00
Pascal Seitz fbb68e4b2b Restore compact term metadata for automaton bitsets 2026-11-24 16:31:36 +01:00
Pascal Seitz 723e8714b1 Read automaton hitsets without a directory cache
Load dictionary blocks asynchronously and stream coalesced postings through FileHandle to build automaton bitsets. Run term enumeration and decoding on the executor, retaining buffers only while needed.

Restore configurable SSTable read coalescing and cover read ranges, decoding, cancellation, buffer release, and errors.
2026-11-24 16:31:36 +01:00
PSeitz 0aa896fe29 Revert "Replace read coalescing with batch reads"
This reverts commit 0354282a4a.
2026-11-18 15:03:13 +01:00
PSeitz 2c4325c5d0 Revert "Return posting ranges directly from warmup tasks"
This reverts commit c466f03b0b.
2026-11-18 15:03:13 +01:00
PSeitz 61f0bfb887 Revert "Hide async batch reads from generated documentation"
This reverts commit 40be82cbe1.
2026-11-18 15:03:13 +01:00
Reacher3745andClaude Opus 5.5 4c5d89386e Document the query-grammar subcrate
Explain what tantivy-query-grammar is responsible for, how it fits
between the query string and QueryParser, and its two entry points.
The README is included as the crate docs so its example is doctested.
Also fix the crate description, keywords and categories, which were
copied from the main crate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 15:22:14 +01:00
Paul MasurelandClaude Opus 5.5 787168c775 Put the plain codec behind a plain_codec feature (#3266)
* Make the onpair dependency optional behind a `plain_codec` feature

OnPair16 compresses the blocks of plain-encoded Str and Bytes columns.
The columnar writer does not emit plain columns yet, so the dependency is
not used in practice.

The new `plain_codec` feature (tantivy and tantivy-columnar) enables it.
It is on by default in tantivy and off by default in tantivy-columnar,
like `zstd-compression`.

Without the feature, plain blocks are always written raw, and reading an
OnPair16 block returns an `Unsupported` io error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Gate the whole plain module behind `plain_codec`

Instead of gating OnPair16 inside the plain module, gate the module itself,
the `DynamicColumn::PlainBytes`/`PlainStr` variants and their match arms.

Without the feature, opening or writing a plain-encoded column panics.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 13:56:30 +01:00
Paul Masurel 058f4973ee Distinguish "no fast field tokenizer" from the raw tokenizer (#3263)
* Distinguish "no fast field tokenizer" from the raw tokenizer

same state, and skipped the tokenizer lookup for "raw". A custom analyzer
registered under "raw" (e.g. Quickwit's raw + RemoveLongFilter(255)) was
then silently ignored.

The fast field tokenizer is now an `Option<String>`:
- `FAST` / `"fast": true`: `None`, values are recorded as is, no lookup.
- `set_fast(name)` / `{"with_tokenizer": name}`: always looked up,
  including "raw".

`set_fast("raw")` now serializes as `{"with_tokenizer": "raw"}` instead
of `true`, so the distinction survives a schema round trip.

* Added method to set up a fast field with a None tokenizer
2026-11-17 12:40:29 +01:00
Pascal Seitz 40be82cbe1 Hide async batch reads from generated documentation 2026-11-17 12:36:52 +01:00
Pascal Seitz c466f03b0b Return posting ranges directly from warmup tasks 2026-11-17 12:36:52 +01:00
Pascal Seitz 0354282a4a Replace read coalescing with batch reads 2026-11-17 12:36:52 +01:00
Adrien Guillo 2ad36b4fd0 Avoid copying blocks in docstore reader with Decompressor::None (#3254) 2026-11-10 15:29:40 -05:00
G Karthik Koundinya d66f88d8f8 Reset BitSet len in clear() (#3241)
BitSet::clear emptied the tinysets but left the cached element count, so len() kept returning the old value and later inserts were over-counted.
2026-11-05 18:36:15 +01:00
Paul Masurel 360a5ebbbb Add ExpUnrolledLinkedList::iter_chunks (#3218)
* Add ExpUnrolledLinkedList::iter_chunks

Adds an iterator over the chunks of an ExpUnrolledLinkedList, one slice
per block, in write order.

read_to_end now goes through ExpUnrolledLinkedListChunks::read_to_end,
which keeps the plain block loop instead of calling next() per chunk.
It also reserves the exact output length upfront, computed from the
block metadata.

* Export ExpUnrolledLinkedListChunks and make read_exact_into public

So callers can name the type returned by iter_chunks, and use
read_exact_into from outside the crate.
2026-10-27 16:04:24 +01:00
Paul Masurel 6bced0ba02 Add the plain codec format to the columnar (#3179)
* Add the plain codec format to the columnar

Adds StrColumnCodec, the column key code of plain columns, the V3
columnar version, and the plain column storage: OnPair16 blocks of at
most 65,536 values and 1 MiB, block index, and reader.

The columnar writer does not produce plain columns yet.

* less result moar panic

* CR Comment. Making PlainColumn Inner type private

* CR comment: checked sorted index in block index.
2026-10-26 11:09:47 +01:00
Yang Baiandybai08 66f8302256 Count chars, not bytes, for the snippet max_num_chars (#3199)
`SnippetGenerator::set_max_num_chars` and `search_fragments` document the
limit as a number of chars (not bytes), but fragments were cut as soon as
their byte length went over it. For non-ASCII text, snippets were therefore
much shorter than requested: about half for Cyrillic or Greek, a third for
CJK.

Count the chars of the fragment instead. Since a char is at least one byte,
the chars only need counting once the byte length exceeds the limit, so ASCII
text does no extra work.

Co-authored-by: ybai08 <271969568+ybai08@users.noreply.github.com>
2026-10-26 10:05:00 +01:00
palmoni5andKleiKodesh df47456ca8 Export PhraseScorer from tantivy::query (#3210)
* Export PhraseScorer from tantivy::query

PhraseScorer already has a public constructor and the Postings trait is public, but the type was only reachable inside the crate. Exporting it lets a custom Query/Weight score a phrase over any Postings, for example a union of several terms at one position, without copying the phrase matching code.

Also documents the struct, the constructor and phrase_count.

* Document that PhraseScorer::new needs two postings

Intersection::new asserts at least two docsets, so a custom Weight whose phrase degenerates to one term must branch before building the scorer.

---------

Co-authored-by: KleiKodesh <211884665+KleiKodesh@users.noreply.github.com>
2026-10-26 10:02:12 +01:00
Pascal Seitz b9c4ed1c62 Rename encoded postings buffer to encoded terminfo 2026-10-23 17:11:03 +02:00
Pascal Seitz 85c15c83f8 Avoid rescanning terms during automaton bitset warmup 2026-10-23 17:11:03 +02:00
Pascal Seitz 9f2f1b2f6c Fix snippet panic with overlapping tokens 2026-10-22 15:10:02 +02:00
Paul Masurel 67889269ca Version bump and changelog for tantivy 0.27 (#3197) 0.27.0 2026-10-17 08:32:20 +02:00
Adrien Guillo e1acb3e011 perf(aggregation): break serial Kahan/Welford chains with accumulator lanes (#3180)
The metric reducers folded values one at a time through recurrences that
carry state across every iteration: Kahan compensated summation in
`collect_stats` (sum/avg/min/max/count/stats) and Welford's online variance
in `extended_stats`. These strict dependency chains block both CPU
pipelining and auto-vectorization.

`collect_stats` now reduces each block of values as a slice into 4
independent Kahan (sum, delta) lanes plus 4 min/max lanes, combined at the
end of the block.

`extended_stats` accumulates each block into 4 independent
`IntermediateExtendedStats` lanes and folds them into the bucket with the
existing `merge_fruits` (Chan parallel-variance combination), the same
operation used to merge segment results. The lanes carry the bucket's sigma,
since `merge_fruits` replaces an empty bucket with the incoming lane.

Blocks with fewer than two values per lane are collected value by value,
where setting up and combining lanes costs more than it saves.

Only the floating-point summation order changes, as it already does across
segment merges. All aggregation tests pass within the existing `2e-12`
tolerance, including the rounding-sensitive `test_aggregation_level1`, and a
new test covers sigma through the lane path.
2026-10-15 10:20:13 -04:00
ZainnQureshiiandClaude Opus 5.5 8a4cfc40f5 Fix stale JSON range query note and ARCHITECTURE.md link
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 21:47:29 +02:00