File tree 1 file changed +11
-9
lines changed
1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change 1
- // # Basic Example
1
+ // # Faceted Search
2
2
//
3
- // This example covers the basic functionalities of
3
+ // This example covers the faceted search functionalities of
4
4
// tantivy.
5
5
//
6
6
// We will :
7
- // - define our schema
8
- // = create an index in a directory
9
- // - index few documents in our index
10
- // - search for the best document matchings "sea whale"
11
- // - retrieve the best document original content.
12
-
7
+ // - define a text field "name" in our schema
8
+ // - define a facet field "classification" in our schema
9
+ // - create an index in memory
10
+ // - index few documents with respective facets in our index
11
+ // - search and count the number of documents that the classifications start the facet "/Felidae"
12
+ // - Search the facet "/Felidae/Pantherinae" and count the number of documents that the
13
+ // classifications include the facet.
14
+ //
13
15
// ---
14
16
// Importing tantivy...
15
17
use tantivy:: collector:: FacetCollector ;
@@ -21,7 +23,7 @@ fn main() -> tantivy::Result<()> {
21
23
// Let's create a temporary directory for the sake of this example
22
24
let mut schema_builder = Schema :: builder ( ) ;
23
25
24
- let name = schema_builder. add_text_field ( "felin_name " , TEXT | STORED ) ;
26
+ let name = schema_builder. add_text_field ( "name " , TEXT | STORED ) ;
25
27
// this is our faceted field: its scientific classification
26
28
let classification = schema_builder. add_facet_field ( "classification" , FacetOptions :: default ( ) ) ;
27
29
You can’t perform that action at this time.
0 commit comments