pub fn create(
index_path: &str,
metadata: &[Value],
doc_ids: &[i64],
) -> Result<usize>Expand description
Create a new SQLite metadata database, replacing any existing one.
Each element in metadata is a JSON object representing a document’s metadata.
The _subset_ column is automatically added as the primary key.
§Arguments
index_path- Path to the index directorymetadata- Slice of JSON objects, one per document
§Returns
Number of rows inserted
§Errors
Returns an error if:
- The index directory cannot be created
- Column names are invalid (SQL injection prevention)
- Database operations fail
§Example
ⓘ
use next-plaid::filtering;
use serde_json::json;
let metadata = vec![
json!({"name": "Alice", "age": 30}),
json!({"name": "Bob", "age": 25, "city": "NYC"}),
];
let doc_ids: Vec<i64> = (0..2).collect();
filtering::create("my_index", &metadata, &doc_ids)?;