mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-04 10:35:46 +01:00
Add index name to unsortable columns error message
This commit is contained in:
parent
d00c187349
commit
b1bc505807
@ -56,7 +56,7 @@ fn main() {
|
||||
Some(path) => TempDir::new_in(path).unwrap(),
|
||||
None => TempDir::new().unwrap(),
|
||||
};
|
||||
let index = Index::new("", options, tempdir.path()).unwrap();
|
||||
let index = Index::new(None, options, tempdir.path()).unwrap();
|
||||
let indexer_config = IndexerConfig::default();
|
||||
let index_documents_config = IndexDocumentsConfig::default();
|
||||
|
||||
|
@ -103,7 +103,7 @@ impl ReopenableIndex {
|
||||
return Ok(());
|
||||
}
|
||||
map.unavailable.remove(&self.uuid);
|
||||
map.create("", &self.uuid, path, None, self.enable_mdb_writemap, self.map_size)?;
|
||||
map.create(None, &self.uuid, path, None, self.enable_mdb_writemap, self.map_size)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@ -167,7 +167,7 @@ impl IndexMap {
|
||||
///
|
||||
pub fn create(
|
||||
&mut self,
|
||||
name: &str,
|
||||
name: Option<String>,
|
||||
uuid: &Uuid,
|
||||
path: &Path,
|
||||
date: Option<(OffsetDateTime, OffsetDateTime)>,
|
||||
@ -297,7 +297,7 @@ impl IndexMap {
|
||||
/// Create or open an index in the specified path.
|
||||
/// The path *must* exist or an error will be thrown.
|
||||
fn create_or_open_index(
|
||||
name: &str,
|
||||
name: Option<String>,
|
||||
path: &Path,
|
||||
date: Option<(OffsetDateTime, OffsetDateTime)>,
|
||||
enable_mdb_writemap: bool,
|
||||
@ -312,14 +312,14 @@ fn create_or_open_index(
|
||||
|
||||
if let Some((created, updated)) = date {
|
||||
Ok(Index::new_with_creation_dates(
|
||||
Some(String::from(name)),
|
||||
name,
|
||||
options,
|
||||
path,
|
||||
created,
|
||||
updated,
|
||||
)?)
|
||||
} else {
|
||||
Ok(Index::new(Some(String::from(name)), options, path)?)
|
||||
Ok(Index::new(name, options, path)?)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ impl IndexMapper {
|
||||
// This is very unlikely to happen in practice.
|
||||
// TODO: it would be better to lazily create the index. But we need an Index::open function for milli.
|
||||
let index = self.index_map.write().unwrap().create(
|
||||
&name,
|
||||
Some(name.to_string()),
|
||||
&uuid,
|
||||
&index_path,
|
||||
date,
|
||||
@ -372,7 +372,7 @@ impl IndexMapper {
|
||||
let index_path = self.base_path.join(uuid.to_string());
|
||||
|
||||
break index_map.create(
|
||||
name,
|
||||
Some(name.to_string()),
|
||||
&uuid,
|
||||
&index_path,
|
||||
None,
|
||||
|
@ -267,7 +267,7 @@ fn export_a_dump(
|
||||
for result in index_mapping.iter(&rtxn)? {
|
||||
let (uid, uuid) = result?;
|
||||
let index_path = db_path.join("indexes").join(uuid.to_string());
|
||||
let index = Index::new("", EnvOpenOptions::new(), &index_path).with_context(|| {
|
||||
let index = Index::new(None, EnvOpenOptions::new(), &index_path).with_context(|| {
|
||||
format!("While trying to open the index at path {:?}", index_path.display())
|
||||
})?;
|
||||
|
||||
|
@ -41,7 +41,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
options.map_size(100 * 1024 * 1024 * 1024); // 100 GB
|
||||
|
||||
std::fs::create_dir_all(&index_path).unwrap();
|
||||
let index = Index::new(program_name.as_str(), options, index_path).unwrap();
|
||||
let index = Index::new(Some(program_name), options, index_path).unwrap();
|
||||
let mut wtxn = index.write_txn().unwrap();
|
||||
|
||||
let config = IndexerConfig::default();
|
||||
|
@ -28,7 +28,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
let mut options = EnvOpenOptions::new();
|
||||
options.map_size(100 * 1024 * 1024 * 1024); // 100 GB
|
||||
|
||||
let index = Index::new(program_name.as_str(), options, dataset)?;
|
||||
let index = Index::new(Some(program_name), options, dataset)?;
|
||||
let txn = index.read_txn()?;
|
||||
let mut query = String::new();
|
||||
while stdin().read_line(&mut query)? > 0 {
|
||||
|
@ -10,7 +10,7 @@ fn main() {
|
||||
let mut options = EnvOpenOptions::new();
|
||||
options.map_size(100 * 1024 * 1024 * 1024); // 100 GB
|
||||
|
||||
let index = Index::new("", options, "data_movies.ms").unwrap();
|
||||
let index = Index::new(None, options, "data_movies.ms").unwrap();
|
||||
let mut wtxn = index.write_txn().unwrap();
|
||||
|
||||
let config = IndexerConfig::default();
|
||||
|
@ -469,7 +469,7 @@ fn conditionally_lookup_for_error_message() {
|
||||
for (list, suffix) in messages {
|
||||
let err = UserError::InvalidSortableAttribute {
|
||||
field: "name".to_string(),
|
||||
index: "index".to_string(),
|
||||
index_name: Some("index".to_string()),
|
||||
valid_fields: list,
|
||||
hidden_fields: false,
|
||||
};
|
||||
|
@ -1557,7 +1557,7 @@ pub(crate) mod tests {
|
||||
let mut options = EnvOpenOptions::new();
|
||||
options.map_size(size);
|
||||
let _tempdir = TempDir::new_in(".").unwrap();
|
||||
let inner = Index::new("temp", options, _tempdir.path()).unwrap();
|
||||
let inner = Index::new(Some("temp".to_string()), options, _tempdir.path()).unwrap();
|
||||
let indexer_config = IndexerConfig::default();
|
||||
let index_documents_config = IndexDocumentsConfig::default();
|
||||
Self { inner, indexer_config, index_documents_config, _tempdir }
|
||||
|
@ -13,7 +13,7 @@ pub fn setup_search_index_with_criteria(criteria: &[Criterion]) -> Index {
|
||||
let path = tempfile::tempdir().unwrap();
|
||||
let mut options = EnvOpenOptions::new();
|
||||
options.map_size(10 * 1024 * 1024); // 10 MB
|
||||
let index = Index::new("", options, &path).unwrap();
|
||||
let index = Index::new(Some("".to_string()), options, &path).unwrap();
|
||||
|
||||
let mut wtxn = index.write_txn().unwrap();
|
||||
let config = IndexerConfig::default();
|
||||
|
@ -13,7 +13,7 @@ fn test_facet_distribution_with_no_facet_values() {
|
||||
let path = tempfile::tempdir().unwrap();
|
||||
let mut options = EnvOpenOptions::new();
|
||||
options.map_size(10 * 1024 * 1024); // 10 MB
|
||||
let index = Index::new("", options, &path).unwrap();
|
||||
let index = Index::new(None, options, &path).unwrap();
|
||||
|
||||
let mut wtxn = index.write_txn().unwrap();
|
||||
let config = IndexerConfig::default();
|
||||
|
@ -31,7 +31,7 @@ pub fn setup_search_index_with_criteria(criteria: &[Criterion]) -> Index {
|
||||
let path = tempfile::tempdir().unwrap();
|
||||
let mut options = EnvOpenOptions::new();
|
||||
options.map_size(10 * 1024 * 1024); // 10 MB
|
||||
let index = Index::new("", options, &path).unwrap();
|
||||
let index = Index::new(None, options, &path).unwrap();
|
||||
|
||||
let mut wtxn = index.write_txn().unwrap();
|
||||
let config = IndexerConfig::default();
|
||||
|
@ -262,7 +262,7 @@ fn criteria_ascdesc() {
|
||||
let path = tempfile::tempdir().unwrap();
|
||||
let mut options = EnvOpenOptions::new();
|
||||
options.map_size(12 * 1024 * 1024); // 10 MB
|
||||
let index = Index::new("", options, &path).unwrap();
|
||||
let index = Index::new(None, options, &path).unwrap();
|
||||
|
||||
let mut wtxn = index.write_txn().unwrap();
|
||||
let config = IndexerConfig::default();
|
||||
|
@ -104,7 +104,7 @@ fn test_typo_disabled_on_word() {
|
||||
let tmp = tempdir().unwrap();
|
||||
let mut options = EnvOpenOptions::new();
|
||||
options.map_size(4096 * 100);
|
||||
let index = Index::new("", options, tmp.path()).unwrap();
|
||||
let index = Index::new(None, options, tmp.path()).unwrap();
|
||||
|
||||
let mut builder = milli::documents::DocumentsBatchBuilder::new(Vec::new());
|
||||
let doc1 = json!({
|
||||
|
Loading…
Reference in New Issue
Block a user