Skip to content

Commit 398817c

Browse files
authored
add index sorting deprecation warning (#2353)
* add index sorting deprecation warning * remove deprecated IntOptions and DatePrecision
1 parent 74940e9 commit 398817c

File tree

9 files changed

+10
-25
lines changed

9 files changed

+10
-25
lines changed

common/src/datetime.rs

-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(deprecated)]
2-
31
use std::fmt;
42
use std::io::{Read, Write};
53

@@ -27,9 +25,6 @@ pub enum DateTimePrecision {
2725
Nanoseconds,
2826
}
2927

30-
#[deprecated(since = "0.20.0", note = "Use `DateTimePrecision` instead")]
31-
pub type DatePrecision = DateTimePrecision;
32-
3328
/// A date/time value with nanoseconds precision.
3429
///
3530
/// This timestamp does not carry any explicit time zone information.

common/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ mod vint;
1515
mod writer;
1616
pub use bitset::*;
1717
pub use byte_count::ByteCount;
18-
#[allow(deprecated)]
19-
pub use datetime::DatePrecision;
2018
pub use datetime::{DateTime, DateTimePrecision};
2119
pub use group_by::GroupByIteratorExtended;
2220
pub use json_path_writer::JsonPathWriter;

src/index/index.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ fn save_new_metas(
8383
///
8484
/// ```
8585
/// use tantivy::schema::*;
86-
/// use tantivy::{Index, IndexSettings, IndexSortByField, Order};
86+
/// use tantivy::{Index, IndexSettings};
8787
///
8888
/// let mut schema_builder = Schema::builder();
8989
/// let id_field = schema_builder.add_text_field("id", STRING);
@@ -96,10 +96,7 @@ fn save_new_metas(
9696
///
9797
/// let schema = schema_builder.build();
9898
/// let settings = IndexSettings{
99-
/// sort_by_field: Some(IndexSortByField{
100-
/// field: "number".to_string(),
101-
/// order: Order::Asc
102-
/// }),
99+
/// docstore_blocksize: 100_000,
103100
/// ..Default::default()
104101
/// };
105102
/// let index = Index::builder().schema(schema).settings(settings).create_in_ram();

src/index/index_meta.rs

+4
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,10 @@ impl Default for IndexSettings {
288288
/// Presorting documents can greatly improve performance
289289
/// in some scenarios, by applying top n
290290
/// optimizations.
291+
#[deprecated(
292+
since = "0.22.0",
293+
note = "We plan to remove index sorting in `0.23`. If you need index sorting, please comment on the related issue https://github.com/quickwit-oss/tantivy/issues/2352 and explain your use case."
294+
)]
291295
#[derive(Clone, Debug, Serialize, Deserialize, Eq, PartialEq)]
292296
pub struct IndexSortByField {
293297
/// The field to sort the documents by

src/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ pub use crate::future_result::FutureResult;
178178
pub type Result<T> = std::result::Result<T, TantivyError>;
179179

180180
mod core;
181+
#[allow(deprecated)] // Remove with index sorting
181182
pub mod indexer;
182183

183184
#[allow(unused_doc_comments)]
@@ -189,6 +190,7 @@ pub mod collector;
189190
pub mod directory;
190191
pub mod fastfield;
191192
pub mod fieldnorm;
193+
#[allow(deprecated)] // Remove with index sorting
192194
pub mod index;
193195
pub mod positions;
194196
pub mod postings;
@@ -223,6 +225,7 @@ pub use self::snippet::{Snippet, SnippetGenerator};
223225
pub use crate::core::json_utils;
224226
pub use crate::core::{Executor, Searcher, SearcherGeneration};
225227
pub use crate::directory::Directory;
228+
#[allow(deprecated)] // Remove with index sorting
226229
pub use crate::index::{
227230
Index, IndexBuilder, IndexMeta, IndexSettings, IndexSortByField, InvertedIndexReader, Order,
228231
Segment, SegmentComponent, SegmentId, SegmentMeta, SegmentReader,
@@ -234,8 +237,6 @@ pub use crate::index::{
234237
pub use crate::indexer::PreparedCommit;
235238
pub use crate::indexer::{IndexWriter, SingleSegmentIndexWriter};
236239
pub use crate::postings::Postings;
237-
#[allow(deprecated)]
238-
pub use crate::schema::DatePrecision;
239240
pub use crate::schema::{DateOptions, DateTimePrecision, Document, TantivyDocument, Term};
240241

241242
/// Index format version.

src/schema/date_time_options.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
use std::ops::BitOr;
22

3-
#[allow(deprecated)]
4-
pub use common::DatePrecision;
53
pub use common::DateTimePrecision;
64
use serde::{Deserialize, Serialize};
75

src/schema/document/de.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ pub enum ValueType {
160160
/// A dynamic object value.
161161
Object,
162162
/// A JSON object value. Deprecated.
163-
#[deprecated]
163+
#[deprecated(note = "We keep this for backwards compatibility, use Object instead")]
164164
JSONObject,
165165
}
166166

src/schema/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ mod text_options;
130130
use columnar::ColumnType;
131131

132132
pub use self::bytes_options::BytesOptions;
133-
#[allow(deprecated)]
134-
pub use self::date_time_options::DatePrecision;
135133
pub use self::date_time_options::{DateOptions, DateTimePrecision, DATE_TIME_PRECISION_INDEXED};
136134
pub use self::document::{DocParsingError, Document, OwnedValue, TantivyDocument, Value};
137135
pub(crate) use self::facet::FACET_SEP_BYTE;
@@ -146,8 +144,6 @@ pub use self::index_record_option::IndexRecordOption;
146144
pub use self::ip_options::{IntoIpv6Addr, IpAddrOptions};
147145
pub use self::json_object_options::JsonObjectOptions;
148146
pub use self::named_field_document::NamedFieldDocument;
149-
#[allow(deprecated)]
150-
pub use self::numeric_options::IntOptions;
151147
pub use self::numeric_options::NumericOptions;
152148
pub use self::schema::{Schema, SchemaBuilder};
153149
pub use self::term::{Term, ValueBytes, JSON_END_OF_PATH};

src/schema/numeric_options.rs

-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ use serde::{Deserialize, Serialize};
55
use super::flags::CoerceFlag;
66
use crate::schema::flags::{FastFlag, IndexedFlag, SchemaFlagList, StoredFlag};
77

8-
#[deprecated(since = "0.17.0", note = "Use NumericOptions instead.")]
9-
/// Deprecated use [`NumericOptions`] instead.
10-
pub type IntOptions = NumericOptions;
11-
128
/// Define how an `u64`, `i64`, or `f64` field should be handled by tantivy.
139
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Default)]
1410
#[serde(from = "NumericOptionsDeser")]

0 commit comments

Comments
 (0)