Do not execute assertion-less doc code examples
- Id
- 890e06d115d68ae4feb515b9fcac66ca004d1018
- Author
- Caio
- Commit time
- 2020-03-20T07:56:28+01:00
Modified tique/src/lib.rs
//! cursor-based pagination (or rather: support for conditionally
//! skipping documents that match the query).
//!
-//! ```rust
+//! ```no_run
//! use tique::conditional_collector::{Ascending, TopCollector};
//! # let f64_field = tantivy::schema::Field::from_field_id(0);
//!
//! Uses your index to find keywords and similar items to your documents
//! or any arbitrary input.
//!
-//!```rust
+//!```no_run
//! # use tantivy::{Index, collector::TopDocs, schema::{Field, Schema, TEXT}};
//! # use tique::topterms::TopTerms;
//! # let mut builder = Schema::builder();
//!
//! **NOTE**: Requires the `queryparser` compilation feature.
//!
-//! ```rust
+//! ```no_run
//! # use tantivy::{Index, schema::Field};
//! # fn test(index: &Index) -> tantivy::Result<()> {
//! # let name = tantivy::schema::Field::from_field_id(0);
Modified tique/src/topterms.rs
//!
//! ## Finding Similar Documents
//!
-//!```rust
+//!```no_run
//! # use tantivy::{DocAddress, Index, Searcher, collector::TopDocs, schema::Field, Result};
//! # use tique::topterms::TopTerms;
//! # fn example(index: &Index, body: Field, title: Field,
//! works via a custom `KeywordAcceptor` that you can use via the
//! `extract_filtered` and `extract_filtered_from_doc` methods:
//!
-//!```rust
+//!```no_run
//! # use tantivy::{Index, schema::{Field, Term}, Result};
//! # use tique::topterms::TopTerms;
//! # fn example(index: &Index, fulltext: Field, input: &str) -> Result<()> {
Modified tique/src/conditional_collector/mod.rs
//! added support for declaring the ordering (ascending or
//! descending) and collection-time conditions.
//!
-//! ```rust
+//! ```no_run
//! # use tique::conditional_collector::{Descending,TopCollector};
//! # use tantivy::Score;
//! # let condition_for_segment = true;
//! You simply choose `Ascending` or `Descending` and let the
//! compiler know:
//!
-//! ```rust
+//! ```no_run
//! # use tique::conditional_collector::{Ascending,TopCollector};
//! # use tantivy::Score;
//! # let limit = 10;
//!
//! This is a valid condition that accepts everything:
//!
-//! ```rust
+//! ```no_run
//! let condition_for_segment = true;
//! ```
//!
//! the `ConditionForSegment` trait and you can use closures as a
//! shortcut:
//!
-//! ```rust
+//! ```no_run
//! # use tantivy::{Score,SegmentReader};
//! # use tique::conditional_collector::{TopCollector,Ascending};
//! # let limit = 10;
//! You can also use these tuples as a condition and they act
//! like a cursor for pagination, so when you do something like:
//!
-//! ```rust
+//! ```no_run
//! # use tantivy::DocAddress;
//! # use tique::conditional_collector::{TopCollector,Descending};
//! let limit = 10;
Modified tique/src/conditional_collector/top_collector.rs
/// The first `Score` type is usually inferred but we need to be
/// explicit for this example.
///
-/// ```rust
+/// ```no_run
/// # use tique::conditional_collector::{TopCollector,Descending};
/// let collector =
/// TopCollector::<tantivy::Score, Descending, _>::new(10, true);
///
/// ## Custom condition from a closure.
///
-/// ```rust
+/// ```no_run
/// # use tantivy::{Score,SegmentReader};
/// # use tique::conditional_collector::{TopCollector,Ascending};
/// let condition_for_segment = |reader: &SegmentReader| {
///
/// ## Customizing the Score
///
-/// ```rust
+/// ```no_run
/// # use tique::conditional_collector::{TopCollector, Ascending};
/// # use tantivy::{SegmentReader, DocId};
/// # let limit = 10;
/// *CAUTION*: Using a field that is not `FAST` or is of a different
/// type than the one you specify will lead to a panic at runtime.
///
-/// ```rust
+/// ```no_run
/// # use tique::conditional_collector::{Ascending, Descending, TopCollector};
/// # let rank_field = tantivy::schema::Field::from_field_id(0);
/// # let id_field = tantivy::schema::Field::from_field_id(1);