Commit d2fb67f5 authored by Emmanuel Raviart's avatar Emmanuel Raviart
Browse files

Add field for main name to issuers.

parent 70a7e3fc
......@@ -12,6 +12,7 @@ fn run_index(data_dir: &Path) -> tantivy::Result<()> {
let schema = index.schema();
let id_field = schema.get_field("id").unwrap();
let main_name_field = schema.get_field("main_name").unwrap();
let name_autocomplete_field = schema.get_field("name_autocomplete").unwrap();
let name_field = schema.get_field("name").unwrap();
let securities_count_field = schema.get_field("securities_count").unwrap();
......@@ -26,6 +27,7 @@ fn run_index(data_dir: &Path) -> tantivy::Result<()> {
let issuer = json::parse(&json_string).expect("Invalid JSON");
let mut issuer_doc = Document::default();
issuer_doc.add_u64(id_field, issuer["id"].as_u64().unwrap());
issuer_doc.add_text(main_name_field, issuer["name"].as_str().unwrap());
for name in issuer["names"].members() {
issuer_doc.add_text(name_autocomplete_field, &name.to_string());
issuer_doc.add_text(name_field, &name.to_string());
......
......@@ -13,6 +13,8 @@ pub fn build_index(data_dir: &Path) -> tantivy::Result<tantivy::Index> {
schema_builder.add_u64_field("id", INT_STORED);
schema_builder.add_text_field("main_name", STORED);
{
let text_field_indexing = TextFieldIndexing::default()
.set_tokenizer("french_tokenizer")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment