Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ have been removed to keep the changelog focused on Yeehaw's history.
- make zstd optional in sstable [#2633](https://github.com/quickwit-oss/yeehaw/pull/2633)(@Parth)
- replace lingering references from `tantivy` to `yeehaw`.
- rename benchmark imports to use the `yeehaw` crate.
- update examples to import the `yeehaw` crate instead of `tantivy`.

## Features/Improvements
- add docs/example and Vec<u32> values to sstable [#2660](https://github.com/quickwit-oss/yeehaw/pull/2660)(@PSeitz)
Expand Down
16 changes: 8 additions & 8 deletions examples/aggregation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
// ---

use serde_json::{Deserializer, Value};
use tantivy::aggregation::agg_req::Aggregations;
use tantivy::aggregation::agg_result::AggregationResults;
use tantivy::aggregation::AggregationCollector;
use tantivy::query::AllQuery;
use tantivy::schema::{self, IndexRecordOption, Schema, TextFieldIndexing, FAST};
use tantivy::{Index, IndexWriter, TantivyDocument};
use yeehaw::aggregation::agg_req::Aggregations;
use yeehaw::aggregation::agg_result::AggregationResults;
use yeehaw::aggregation::AggregationCollector;
use yeehaw::query::AllQuery;
use yeehaw::schema::{self, IndexRecordOption, Schema, TextFieldIndexing, FAST};
use yeehaw::{Index, IndexWriter, TantivyDocument};

fn main() -> tantivy::Result<()> {
fn main() -> yeehaw::Result<()> {
// # Create Schema
//
// Lets create a schema for a footwear shop, with 4 fields: name, category, stock and price.
Expand All @@ -28,7 +28,7 @@ fn main() -> tantivy::Result<()> {
// - `raw` tokenizer
//
// The tokenizer is set to "raw", because the fast field uses the same dictionary as the
// inverted index. (This behaviour will change in tantivy 0.20, where the fast field will
// inverted index. (This behaviour will change in yeehaw 0.20, where the fast field will
// always be raw tokenized independent from the regular tokenizing)
//
let text_fieldtype = schema::TextOptions::default()
Expand Down
30 changes: 15 additions & 15 deletions examples/basic_search.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// # Basic Example
//
// This example covers the basic functionalities of
// tantivy.
// yeehaw.
//
// We will :
// - define our schema
Expand All @@ -11,21 +11,21 @@
// - retrieve the best document's original content.

// ---
// Importing tantivy...
use tantivy::collector::TopDocs;
use tantivy::query::QueryParser;
use tantivy::schema::*;
use tantivy::{doc, Index, IndexWriter, ReloadPolicy};
// Importing yeehaw...
use tempfile::TempDir;
use yeehaw::collector::TopDocs;
use yeehaw::query::QueryParser;
use yeehaw::schema::*;
use yeehaw::{doc, Index, IndexWriter, ReloadPolicy};

fn main() -> tantivy::Result<()> {
fn main() -> yeehaw::Result<()> {
// Let's create a temporary directory for the
// sake of this example
let index_path = TempDir::new()?;

// # Defining the schema
//
// The Tantivy index requires a very strict schema.
// The Yeehaw index requires a very strict schema.
// The schema declares which fields are in the index,
// and for each field, its type and "the way it should
// be indexed".
Expand Down Expand Up @@ -72,7 +72,7 @@ fn main() -> tantivy::Result<()> {
// This single `IndexWriter` is already
// multithreaded.
//
// Here we give tantivy a budget of `50MB`.
// Here we give yeehaw a budget of `50MB`.
// Using a bigger memory_arena for the indexer may increase
// throughput, but 50 MB is already plenty.
let mut index_writer: IndexWriter = index.writer(50_000_000)?;
Expand All @@ -98,7 +98,7 @@ fn main() -> tantivy::Result<()> {
// ... and add it to the `IndexWriter`.
index_writer.add_document(old_man_doc)?;

// For convenience, tantivy also comes with a macro to
// For convenience, yeehaw also comes with a macro to
// reduce the boilerplate above.
index_writer.add_document(doc!(
title => "Of Mice and Men",
Expand All @@ -123,8 +123,8 @@ fn main() -> tantivy::Result<()> {
))?;

// This is an example, so we will only index 3 documents
// here. You can check out tantivy's tutorial to index
// the English wikipedia. Tantivy's indexing is rather fast.
// here. You can check out yeehaw's tutorial to index
// the English wikipedia. Yeehaw's indexing is rather fast.
// Indexing 5 million articles of the English wikipedia takes
// around 3 minutes on my computer!

Expand All @@ -146,7 +146,7 @@ fn main() -> tantivy::Result<()> {
// persistently indexed.
//
// In the scenario of a crash or a power failure,
// tantivy behaves as if it has rolled back to its last
// yeehaw behaves as if it has rolled back to its last
// commit.

// # Searching
Expand Down Expand Up @@ -185,7 +185,7 @@ fn main() -> tantivy::Result<()> {

// The query parser can interpret human queries.
// Here, if the user does not specify which
// field they want to search, tantivy will search
// field they want to search, yeehaw will search
// in both title and body.
let query_parser = QueryParser::for_index(&index, vec![title, body]);

Expand All @@ -211,7 +211,7 @@ fn main() -> tantivy::Result<()> {
let top_docs = searcher.search(&query, &TopDocs::with_limit(10))?;

// The actual documents still need to be
// retrieved from Tantivy's store.
// retrieved from Yeehaw's store.
//
// Since the body field was not configured as stored,
// the document returned will only contain
Expand Down
22 changes: 11 additions & 11 deletions examples/custom_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
// collector. As an example, we will compute a collector
// that computes the standard deviation of a given fast field.
//
// Of course, you can have a look at the tantivy's built-in collectors
// Of course, you can have a look at the yeehaw's built-in collectors
// such as the `CountCollector` for more examples.

use columnar::Column;
// ---
// Importing tantivy...
use tantivy::collector::{Collector, SegmentCollector};
use tantivy::index::SegmentReader;
use tantivy::query::QueryParser;
use tantivy::schema::{Schema, FAST, INDEXED, TEXT};
use tantivy::{doc, Index, IndexWriter, Score};
// Importing yeehaw...
use yeehaw::collector::{Collector, SegmentCollector};
use yeehaw::index::SegmentReader;
use yeehaw::query::QueryParser;
use yeehaw::schema::{Schema, FAST, INDEXED, TEXT};
use yeehaw::{doc, Index, IndexWriter, Score};

#[derive(Default)]
struct Stats {
Expand Down Expand Up @@ -71,7 +71,7 @@ impl Collector for StatsCollector {
&self,
_segment_local_id: u32,
segment_reader: &SegmentReader,
) -> tantivy::Result<StatsSegmentCollector> {
) -> yeehaw::Result<StatsSegmentCollector> {
let fast_field_reader = segment_reader.fast_fields().u64(&self.field)?;
Ok(StatsSegmentCollector {
fast_field_reader,
Expand All @@ -84,7 +84,7 @@ impl Collector for StatsCollector {
false
}

fn merge_fruits(&self, segment_stats: Vec<Option<Stats>>) -> tantivy::Result<Option<Stats>> {
fn merge_fruits(&self, segment_stats: Vec<Option<Stats>>) -> yeehaw::Result<Option<Stats>> {
let mut stats = Stats::default();
for segment_stats in segment_stats.into_iter().flatten() {
stats.count += segment_stats.count;
Expand Down Expand Up @@ -119,10 +119,10 @@ impl SegmentCollector for StatsSegmentCollector {
}
}

fn main() -> tantivy::Result<()> {
fn main() -> yeehaw::Result<()> {
// # Defining the schema
//
// The Tantivy index requires a very strict schema.
// The Yeehaw index requires a very strict schema.
// The schema declares which fields are in the index,
// and for each field, its type and "the way it should
// be indexed".
Expand Down
16 changes: 8 additions & 8 deletions examples/custom_tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
//
// In this example, we'll see how to define a tokenizer
// by creating a custom `NgramTokenizer`.
use tantivy::collector::TopDocs;
use tantivy::query::QueryParser;
use tantivy::schema::*;
use tantivy::tokenizer::NgramTokenizer;
use tantivy::{doc, Index, IndexWriter};
use yeehaw::collector::TopDocs;
use yeehaw::query::QueryParser;
use yeehaw::schema::*;
use yeehaw::tokenizer::NgramTokenizer;
use yeehaw::{doc, Index, IndexWriter};

fn main() -> tantivy::Result<()> {
fn main() -> yeehaw::Result<()> {
// # Defining the schema
//
// The Tantivy index requires a very strict schema.
// The Yeehaw index requires a very strict schema.
// The schema declares which fields are in the index,
// and for each field, its type and "the way it should
// be indexed".
Expand Down Expand Up @@ -93,7 +93,7 @@ fn main() -> tantivy::Result<()> {

// The query parser can interpret human queries.
// Here, if the user does not specify which
// field they want to search, tantivy will search
// field they want to search, yeehaw will search
// in both title and body.
let query_parser = QueryParser::for_index(&index, vec![title, body]);

Expand Down
12 changes: 6 additions & 6 deletions examples/date_time_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
//
// This example shows how the DateTime field can be used

use tantivy::collector::TopDocs;
use tantivy::query::QueryParser;
use tantivy::schema::{DateOptions, Document, Schema, Value, INDEXED, STORED, STRING};
use tantivy::{Index, IndexWriter, TantivyDocument};
use yeehaw::collector::TopDocs;
use yeehaw::query::QueryParser;
use yeehaw::schema::{DateOptions, Document, Schema, Value, INDEXED, STORED, STRING};
use yeehaw::{Index, IndexWriter, TantivyDocument};

fn main() -> tantivy::Result<()> {
fn main() -> yeehaw::Result<()> {
// # Defining the schema
let mut schema_builder = Schema::builder();
let opts = DateOptions::from(INDEXED)
.set_stored()
.set_fast()
.set_precision(tantivy::schema::DateTimePrecision::Seconds);
.set_precision(yeehaw::schema::DateTimePrecision::Seconds);
// Add `occurred_at` date field type
let occurred_at = schema_builder.add_date_field("occurred_at", opts);
let event_type = schema_builder.add_text_field("event", STRING | STORED);
Expand Down
26 changes: 13 additions & 13 deletions examples/deleting_updating_documents.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
// # Deleting and Updating (?) documents
//
// This example explains how to delete and update documents.
// In fact there is actually no such thing as an update in tantivy.
// In fact there is actually no such thing as an update in yeehaw.
//
// To update a document, you need to delete a document and then reinsert
// its new version.
//
// ---
// Importing tantivy...
use tantivy::collector::TopDocs;
use tantivy::query::TermQuery;
use tantivy::schema::*;
use tantivy::{doc, Index, IndexReader, IndexWriter};
// Importing yeehaw...
use yeehaw::collector::TopDocs;
use yeehaw::query::TermQuery;
use yeehaw::schema::*;
use yeehaw::{doc, Index, IndexReader, IndexWriter};

// A simple helper function to fetch a single document
// given its id from our index.
// It will be helpful to check our work.
fn extract_doc_given_isbn(
reader: &IndexReader,
isbn_term: &Term,
) -> tantivy::Result<Option<TantivyDocument>> {
) -> yeehaw::Result<Option<TantivyDocument>> {
let searcher = reader.searcher();

// This is the simplest query you can think of.
Expand All @@ -39,14 +39,14 @@ fn extract_doc_given_isbn(
}
}

fn main() -> tantivy::Result<()> {
fn main() -> yeehaw::Result<()> {
// # Defining the schema
//
// Check out the *basic_search* example if this makes
// small sense to you.
let mut schema_builder = Schema::builder();

// Tantivy does not really have a notion of primary id.
// Yeehaw does not really have a notion of primary id.
// This may change in the future.
//
// Still, we can create a `isbn` field and use it as an id. This
Expand All @@ -57,7 +57,7 @@ fn main() -> tantivy::Result<()> {
// running any text processing on it.
// This is done by associating this field to the tokenizer named `raw`.
// Rather than building our
// [`TextOptions`](//docs.rs/tantivy/~0/tantivy/schema/struct.TextOptions.html) manually, We
// [`TextOptions`](//docs.rs/yeehaw/~0/yeehaw/schema/struct.TextOptions.html) manually, We
// use the `STRING` shortcut. `STRING` stands for indexed (without term frequency or positions)
// and untokenized.
//
Expand Down Expand Up @@ -102,17 +102,17 @@ fn main() -> tantivy::Result<()> {
//
// Here we will want to update the typo in the `Frankenstein` book.
//
// Tantivy does not handle updates directly, we need to delete
// Yeehaw does not handle updates directly, we need to delete
// and reinsert the document.
//
// This can be complicated as it means you need to have access
// to the entire document. It is good practise to integrate tantivy
// to the entire document. It is good practise to integrate yeehaw
// with a key value store for this reason.
//
// To remove one of the document, we just call `delete_term`
// on its id.
//
// Note that `tantivy` does nothing to enforce the idea that
// Note that `yeehaw` does nothing to enforce the idea that
// there is only one document associated with this id.
//
// Also you might have noticed that we apply the delete before
Expand Down
16 changes: 8 additions & 8 deletions examples/faceted_search.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// # Faceted Search
//
// This example covers the faceted search functionalities of
// tantivy.
// yeehaw.
//
// We will :
// - define a text field "name" in our schema
Expand All @@ -13,13 +13,13 @@
// classifications include the facet.
//
// ---
// Importing tantivy...
use tantivy::collector::FacetCollector;
use tantivy::query::{AllQuery, TermQuery};
use tantivy::schema::*;
use tantivy::{doc, Index, IndexWriter};
// Importing yeehaw...
use yeehaw::collector::FacetCollector;
use yeehaw::query::{AllQuery, TermQuery};
use yeehaw::schema::*;
use yeehaw::{doc, Index, IndexWriter};

fn main() -> tantivy::Result<()> {
fn main() -> yeehaw::Result<()> {
// Let's create a temporary directory for the sake of this example
let mut schema_builder = Schema::builder();

Expand All @@ -32,7 +32,7 @@ fn main() -> tantivy::Result<()> {

let mut index_writer: IndexWriter = index.writer(30_000_000)?;

// For convenience, tantivy also comes with a macro to
// For convenience, yeehaw also comes with a macro to
// reduce the boilerplate above.
index_writer.add_document(doc!(
name => "Cat",
Expand Down
12 changes: 6 additions & 6 deletions examples/faceted_search_with_tweaked_score.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
// # Faceted Search With Tweak Score
//
// This example covers the faceted search functionalities of
// tantivy.
// yeehaw.
//
// We will :
// - define a text field "name" in our schema
// - define a facet field "classification" in our schema

use std::collections::HashSet;

use tantivy::collector::TopDocs;
use tantivy::query::BooleanQuery;
use tantivy::schema::*;
use tantivy::{doc, DocId, Index, IndexWriter, Score, SegmentReader};
use yeehaw::collector::TopDocs;
use yeehaw::query::BooleanQuery;
use yeehaw::schema::*;
use yeehaw::{doc, DocId, Index, IndexWriter, Score, SegmentReader};

fn main() -> tantivy::Result<()> {
fn main() -> yeehaw::Result<()> {
let mut schema_builder = Schema::builder();

let title = schema_builder.add_text_field("title", STORED);
Expand Down
Loading
Loading