fix: index_stats works for FTS indices (#1780)

When running `index_stats()` for an FTS index, users would get the
deserialization error:

```
InvalidInput { message: "error deserializing index statistics: unknown variant `Inverted`, expected one of `IvfPq`, `IvfHnswPq`, `IvfHnswSq`, `BTree`, `Bitmap`, `LabelList`, `FTS` at line 1 column 24" }
```
This commit is contained in:
Will Jones
2024-10-30 11:33:49 -07:00
committed by GitHub
parent 02535bdc88
commit 113cd6995b
2 changed files with 7 additions and 0 deletions

View File

@@ -119,6 +119,7 @@ pub enum IndexType {
#[serde(alias = "LABEL_LIST")]
LabelList,
// FTS
#[serde(alias = "INVERTED", alias = "Inverted")]
FTS,
}

View File

@@ -3123,6 +3123,12 @@ mod tests {
assert_eq!(index.index_type, crate::index::IndexType::FTS);
assert_eq!(index.columns, vec!["text".to_string()]);
assert_eq!(index.name, "text_idx");
let stats = table.index_stats("text_idx").await.unwrap().unwrap();
assert_eq!(stats.num_indexed_rows, num_rows);
assert_eq!(stats.num_unindexed_rows, 0);
assert_eq!(stats.index_type, crate::index::IndexType::FTS);
assert_eq!(stats.distance_type, None);
}
#[tokio::test]