mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-01-04 16:22:55 +00:00
doc: update comments in the faceted search example (#1737)
* doc: update comments in the faceted search example * chore: format
This commit is contained in:
@@ -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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user