Repository navigation
Sort index by field - #6833
Sort index by field#6833guilload wants to merge 1 commit into
Conversation
| tag_fields: [service] | ||
|
|
||
| indexing_settings: | ||
| sort_fields: [service] | ||
| ``` | ||
|
|
||
| `sort_fields` accepts a list of mapped field names but currently rejects more than one entry. | ||
| A bare name sorts ascending; prefix it with `-` for descending order, for example | ||
| `sort_fields: [-service]`. An explicit `+` also means ascending. Nested paths and escaped dots | ||
| use the same syntax as other field references. Empty names and repeated direction prefixes are | ||
| rejected. The field must be indexed with the `raw` tokenizer and use a raw fast-field normalizer. |
There was a problem hiding this comment.
tag_fields should have been part of indexing_settings :/
| first for `asc` and last for `desc`; an empty string is a distinct value. Equal values retain all | ||
| documents. Physical ordering does not change query result ordering. | ||
|
|
||
| Generation-zero splits are sorted during indexing. Compaction preserves the input order, |
| and are compacted separately. This setting does not repartition splits or select service-specific | ||
| output boundaries. | ||
|
|
||
| Physical field sorting cannot be combined with node-level document fingerprint clustering; |
| a field name with a hyphen `-`. | ||
| The special value `_score` means sorting by score, it is also Descending by default. | ||
|
|
||
| The prefix parser is shared with `indexing_settings.sort_fields` through |
There was a problem hiding this comment.
Can the parse be moved to quickwit-common?
| metadata and direct lineage needed to reconstruct its metastore record. | ||
|
|
||
| Splits may declare `sort_fields` in their metastore metadata and recovery entry. Each entry | ||
| records a field name, direction, and logical comparison type, for example |
There was a problem hiding this comment.
| records a field name, direction, and logical comparison type, for example | |
| records a field name, order, and type, for example |
| // but this will require work on tantivy. | ||
| let indexed_split = IndexedSplit { | ||
| split_attrs: SplitAttrs { | ||
| split_id: "test-split".into(), |
There was a problem hiding this comment.
| split_id: "test-split".into(), | |
| split_id: "test-split".to_string(), |
| .send_message(PackagedSplitBatch::new( | ||
| vec![PackagedSplit { | ||
| split_attrs: SplitAttrs { | ||
| split_id: "test-split".into(), |
There was a problem hiding this comment.
| split_id: "test-split".into(), | |
| split_id: "test-split".to_string(), |
| let split_scratch_directory_2 = TempDirectory::for_test(); | ||
| let packaged_split_1 = PackagedSplit { | ||
| split_attrs: SplitAttrs { | ||
| split_id: "test-split-1".into(), |
There was a problem hiding this comment.
| split_id: "test-split-1".into(), | |
| split_id: "test-split-1".to_string(), |
Explicit conversions via to_string() are better than implicit conversations via into. Apply this suggestion everywhere.
| index_uid: pipeline_id.index_uid, | ||
| source_id: pipeline_id.source_id, | ||
| doc_mapping_uid, | ||
| sort_fields: Vec::new(), |
There was a problem hiding this comment.
sort_fields should be known by know why can't we pass it directly and remove the garbage tantivy_sort_by_field, resolve_sort_fields, etc.?
| /// Declaring a type here does not enable indexing configuration support for that type. | ||
| #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Serialize, Deserialize, utoipa::ToSchema)] | ||
| #[serde(rename_all = "lowercase")] | ||
| pub enum SortValueType { |
There was a problem hiding this comment.
Can we rationalize with what already exists in quickwit-search (SortFieldType, etc.) so we can remove SortValueType, SplitSortFieldType, etc.
0119e60 to
998682c
Compare
Description
Introduce ability to sort an index by a single field.
How was this PR tested?
Describe how you tested this PR.