mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-25 19:45:05 +08:00
fix: Prefer using the group_id instead of the product_id
The product_id is an id that identify each group variant (e.g. color, size...), it is not useful for the relevance for the moment.
This commit is contained in:
parent
d8ad4f5063
commit
626f69737e
@ -17,7 +17,7 @@ use unidecode::unidecode;
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct Product {
|
||||
title: String,
|
||||
product_id: u64,
|
||||
group_id: u64,
|
||||
ft: String,
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ fn main() {
|
||||
let words = title.chain(description);
|
||||
for (i, (attr, word)) in words {
|
||||
let doc_index = DocIndex {
|
||||
document: product.product_id,
|
||||
document: product.group_id,
|
||||
attribute: attr,
|
||||
attribute_index: i as u32,
|
||||
};
|
||||
@ -95,11 +95,11 @@ fn main() {
|
||||
|
||||
// TODO simplify this by using functions and
|
||||
// use the MetadataBuilder internal BTreeMap ?
|
||||
let key = format!("{}-title", product.product_id);
|
||||
let key = format!("{}-title", product.group_id);
|
||||
let value = product.title;
|
||||
fields.insert(key, value);
|
||||
|
||||
let key = format!("{}-description", product.product_id);
|
||||
let key = format!("{}-description", product.group_id);
|
||||
let value = product.ft;
|
||||
fields.insert(key, value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user