Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a0c128488b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b2a545cc4d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 81fab0eff2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| The field has no parameters. Values provided in documents are ignored, and generated values are preserved across merges. Values are almost always distinct but not guaranteed to be unique, so they should not be used as document identifiers. In particular, paginating with `search_after` on a primary sort field and a `tie_breaker` field can skip documents that share both values. Sort on `_shard_doc` instead when every document must be returned exactly once. | ||
|
|
||
| The field is not stored and only supports range queries. `array<tie_breaker>` is not supported, and a `tie_breaker` field cannot be added to an existing index by updating its doc mapping: the index must be created with it. |
There was a problem hiding this comment.
so it's fast but not stored and not indexed? (to use the terminology of normal fields)
i don't recall wether we allow term:value to match on fast non-indexed values by transforming into a term:[value TO value] query, or if we require the caller to do that themself
There was a problem hiding this comment.
Yes. It's fast, not stored and not indexed. The docs say it behaves like a u64 field with fast: true, stored: false and indexed: false, and that term and range queries run on the fast field.
Quickwit does the conversion for fast-only fields: it builds a regular term and Tantivy falls back to an exact range on the fast field when it's not indexed.
d8f657a builds the same u64 term as a fast-only u64 field (see here). A tie_breaker:123 query now works.
| type: tie_breaker | ||
| ``` | ||
|
|
||
| The field has no parameters. Values provided in documents are ignored, and generated values are preserved across merges. Values are almost always distinct but not guaranteed to be unique, so they should not be used as document identifiers. In particular, paginating with `search_after` on a primary sort field and a `tie_breaker` field can skip documents that share both values. Sort on `_shard_doc` instead when every document must be returned exactly once. |
There was a problem hiding this comment.
i think in strict doc mapping this should reject the document, in lenient and dynamic ignored is correct
(also, because _shard_doc is mentioned, worth saying that contrary to tiebreakers, it isn't stable in quickwit)
| // Tie-breaker values are only generated for newly indexed documents, so existing splits would | ||
| // have no values for a tie-breaker field added by an update. |
There was a problem hiding this comment.
unless having docs with a value and other without causes specific problems, i don't think this should be enforced: it's fine to add fields in general, they will be missing from previous docs (and for non-generated fields, they can even be missing from new documents)
There was a problem hiding this comment.
Makes sense, removed in 10c437e. Docs indexed before the update just won't have a value, same as any newly added field. I updated the docs to mention it.
| LeafType::IpAddr(_) => value_to_ip(value), | ||
| LeafType::F64(numeric_options) => value_to_float(value, numeric_options), | ||
| LeafType::U64(numeric_options) => value_to_u64(value, numeric_options), | ||
| LeafType::TieBreaker => match value { |
There was a problem hiding this comment.
i think it would make sense to be more lenient and use value_to_u64 here
There was a problem hiding this comment.
Done in 27a9807. The numeric options are built explicitly (fast only, not stored, not indexed, no coercion), with a comment noting that only output_format (Number) is actually read by value_to_u64.
| }; | ||
|
|
||
| let ascending_hits = search_hits(SortOrder::Asc).await; | ||
| assert!(ascending_hits.windows(2).all(|hits| hits[0].2 <= hits[1].2)); |
There was a problem hiding this comment.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 27a9807dc0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| The field has no parameters. Values provided in documents are ignored, and generated values are preserved across merges. Values are almost always distinct but not guaranteed to be unique, so they should not be used as document identifiers. In particular, paginating with `search_after` on a primary sort field and a `tie_breaker` field can skip documents that share both values. Sort on `_shard_doc` instead when every document must be returned exactly once. | ||
|
|
||
| The field is not stored and only supports range queries. `array<tie_breaker>` is not supported. When a `tie_breaker` field is added to an existing index by updating its doc mapping, documents indexed before the update have no value for it. |
This comment was marked as low quality.
This comment was marked as low quality.
Sorry, something went wrong.
Description
Adds a new
tie_breakerfield mapping type, backed by Tantivy's generatedTieBreakerfast field introduced in quickwit-oss/tantivy#3143.A tie-breaker field is a
u64fast field whose values are generated at indexing time rather than read from documents. Within a split, values are consecutive starting from a random offset, and they are preserved when splits are merged, so a document keeps its value for its whole lifetime. The intended use is as a secondary sort key that reduces ties among documents with equal primary sort values.Values are almost always distinct across splits but not guaranteed unique (they are currently limited to the
u32range). Paginating withsearch_afteron a primary sort field plus atie_breakerfield can therefore skip documents that share both values;_shard_docremains the way to get exact pagination.Example doc mapping:
Behavior
{"name": ..., "type": "tie_breaker"}.array<tie_breaker>is not supported.tie_breakerfield (including nested in an object) through a doc mapping update is rejected, because existing splits would have no values for it. The index must be created with the field._source/hits; it is readable as a fast field.tie_breaker fields are not term-searchable).u64fast-field range._mappingAPI: reported aslong, likeu64.docs/configuration/index-config.md.Other changes
tantivy/tantivy-commonto4abc20f, the merge commit of feat: add generated tie-breaker fast fields tantivy#3143 (tip of Tantivymain).AggContextParams::value_sourcesfield by constructing it withAggContextParams::new(...).How was this PR tested?
tie_breakermapping round-trips through serialization/deserialization.tie_breakermappings with parameters are rejected.tie_breakertype id parses and serializes correctly.tie_breakerfield are ignored.tie_breakerfield are rejected.cargo checkon the full workspace; tests ofquickwit-doc-mapper,quickwit-configandquickwit-query.make fmt.Not yet covered by tests: sorting on a
tie_breakerfield, the term-query error, and the Elasticsearch_mappingtype.