mirror of
				https://github.com/meilisearch/meilisearch.git
				synced 2025-11-04 09:56:28 +00:00 
			
		
		
		
	Fix the nested document id fetching function
This commit is contained in:
		@@ -204,7 +204,9 @@ impl PrimaryKey<'_> {
 | 
			
		||||
    /// can have depending of the first level name and deepnes of the objects.
 | 
			
		||||
    fn possible_level_names(&self) -> impl Iterator<Item = (&str, &str)> + '_ {
 | 
			
		||||
        let name = self.name();
 | 
			
		||||
        iter::successors(Some((name, "")), |(curr, _)| curr.rsplit_once(PRIMARY_KEY_SPLIT_SYMBOL))
 | 
			
		||||
        name.match_indices(PRIMARY_KEY_SPLIT_SYMBOL)
 | 
			
		||||
            .map(move |(i, _)| (&name[..i], &name[i + PRIMARY_KEY_SPLIT_SYMBOL.len_utf8()..]))
 | 
			
		||||
            .chain(iter::once((name, "")))
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1198,7 +1198,7 @@ mod tests {
 | 
			
		||||
        let error = builder.execute().unwrap_err();
 | 
			
		||||
        assert_eq!(
 | 
			
		||||
            &error.to_string(),
 | 
			
		||||
            r#"Could not parse latitude in the document with the id: `0`. Was expecting a number but instead got `"lol"`."#
 | 
			
		||||
            r#"Could not parse latitude in the document with the id: `0`. Was expecting a finite number but instead got `"lol"`."#
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        let documents = documents!([
 | 
			
		||||
@@ -1212,7 +1212,7 @@ mod tests {
 | 
			
		||||
        let error = builder.execute().unwrap_err();
 | 
			
		||||
        assert_eq!(
 | 
			
		||||
            &error.to_string(),
 | 
			
		||||
            r#"Could not parse latitude in the document with the id: `0`. Was expecting a number but instead got `[12,13]`."#
 | 
			
		||||
            r#"Could not parse latitude in the document with the id: `0`. Was expecting a finite number but instead got `[12,13]`."#
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        let documents = documents!([
 | 
			
		||||
@@ -1226,7 +1226,7 @@ mod tests {
 | 
			
		||||
        let error = builder.execute().unwrap_err();
 | 
			
		||||
        assert_eq!(
 | 
			
		||||
            &error.to_string(),
 | 
			
		||||
            r#"Could not parse longitude in the document with the id: `0`. Was expecting a number but instead got `"hello"`."#
 | 
			
		||||
            r#"Could not parse longitude in the document with the id: `0`. Was expecting a finite number but instead got `"hello"`."#
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user