Skip to content

Commit

Permalink
doc: update comments in the faceted search example (#1737)
Browse files Browse the repository at this point in the history
* doc: update comments in the faceted search example

* chore: format
  • Loading branch information
DawChihLiou committed Jan 2, 2023
1 parent b78dc5e commit b22f966
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions examples/faceted_search.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
// # Basic Example
// # Faceted Search
//
// This example covers the basic functionalities of
// This example covers the faceted search functionalities of
// tantivy.
//
// We will :
// - define our schema
// = create an index in a directory
// - index few documents in our index
// - search for the best document matchings "sea whale"
// - retrieve the best document original content.

// - define a text field "name" in our schema
// - define a facet field "classification" in our schema
// - create an index in memory
// - index few documents with respective facets in our index
// - search and count the number of documents that the classifications start the facet "/Felidae"
// - Search the facet "/Felidae/Pantherinae" and count the number of documents that the
// classifications include the facet.
//
// ---
// Importing tantivy...
use tantivy::collector::FacetCollector;
Expand All @@ -21,7 +23,7 @@ fn main() -> tantivy::Result<()> {
// Let's create a temporary directory for the sake of this example
let mut schema_builder = Schema::builder();

let name = schema_builder.add_text_field("felin_name", TEXT | STORED);
let name = schema_builder.add_text_field("name", TEXT | STORED);
// this is our faceted field: its scientific classification
let classification = schema_builder.add_facet_field("classification", FacetOptions::default());

Expand Down

0 comments on commit b22f966

Please sign in to comment.