diff --git a/examples/faceted_search.rs b/examples/faceted_search.rs index 4b0edee14..e38364890 100644 --- a/examples/faceted_search.rs +++ b/examples/faceted_search.rs @@ -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; @@ -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());