mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 20:07:09 +02:00
when no searchable attributes are defined, makes all the weight equals to zero
This commit is contained in:
parent
c78a2fa4f5
commit
f2d0a59f1d
6 changed files with 14 additions and 14 deletions
|
@ -21,9 +21,9 @@ impl FieldidsWeightsMap {
|
|||
|
||||
/// Create the map from the fields ids maps.
|
||||
/// Should only be called in the case there are NO searchable attributes.
|
||||
/// The weights and the fields ids will have the same values.
|
||||
/// All the fields will be inserted in the order of the fields ids map with a weight of 0.
|
||||
pub fn from_field_id_map_without_searchable(fid_map: &FieldsIdsMap) -> Self {
|
||||
FieldidsWeightsMap { map: fid_map.ids().map(|fid| (fid, fid)).collect() }
|
||||
FieldidsWeightsMap { map: fid_map.ids().map(|fid| (fid, 0)).collect() }
|
||||
}
|
||||
|
||||
/// Removes a field id from the map, returning the associated weight previously in the map.
|
||||
|
|
|
@ -2492,7 +2492,7 @@ pub(crate) mod tests {
|
|||
db_snap!(index, fieldids_weights_map, @r###"
|
||||
fid weight
|
||||
0 0 |
|
||||
1 1 |
|
||||
1 0 |
|
||||
"###);
|
||||
|
||||
index.delete_documents(Default::default());
|
||||
|
@ -2512,7 +2512,7 @@ pub(crate) mod tests {
|
|||
db_snap!(index, fieldids_weights_map, @r###"
|
||||
fid weight
|
||||
0 0 |
|
||||
1 1 |
|
||||
1 0 |
|
||||
"###);
|
||||
|
||||
index
|
||||
|
@ -2537,7 +2537,7 @@ pub(crate) mod tests {
|
|||
db_snap!(index, fieldids_weights_map, @r###"
|
||||
fid weight
|
||||
0 0 |
|
||||
1 1 |
|
||||
1 0 |
|
||||
"###);
|
||||
|
||||
let rtxn = index.read_txn().unwrap();
|
||||
|
|
|
@ -1587,8 +1587,8 @@ mod tests {
|
|||
db_snap!(index, fieldids_weights_map, @r###"
|
||||
fid weight
|
||||
0 0 |
|
||||
1 1 |
|
||||
2 2 |
|
||||
1 0 |
|
||||
2 0 |
|
||||
"###);
|
||||
|
||||
// Check that the searchable field have been reset and documents are found now.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue