review and fix all error codes

This commit is contained in:
Tamo
2025-09-17 12:14:11 +02:00
parent fec10bb2d6
commit 716c67f858
6 changed files with 19 additions and 15 deletions

View File

@@ -10,7 +10,7 @@ use crate::error::GeoError;
use crate::update::del_add::{DelAdd, KvReaderDelAdd, KvWriterDelAdd};
use crate::update::index_documents::extract_finite_float_from_value;
use crate::update::settings::{InnerIndexSettings, InnerIndexSettingsDiff};
use crate::{DocumentId, FieldId, InternalError, Result};
use crate::{DocumentId, FieldId, InternalError, Result, UserError};
/// Extracts the geographical coordinates contained in each document under the `_geo` field.
///
@@ -174,9 +174,8 @@ fn extract_geojson_field(
match settings.geojson_fid {
Some(fid) if settings.filterable_attributes_rules.iter().any(|rule| rule.has_geojson()) => {
let value = obkv.get(fid).map(KvReaderDelAdd::from_slice).and_then(|r| r.get(deladd));
// TODO: That's a user error, not an internal error
Ok(value
.map(|v| serde_json::from_slice(v).map_err(InternalError::SerdeJson))
.map(|v| GeoJson::from_reader(v).map_err(UserError::MalformedGeojson))
.transpose()?)
}
_ => Ok(None),

View File

@@ -244,9 +244,7 @@ fn send_original_documents_data(
let original_documents_chunk =
original_documents_chunk.and_then(|c| unsafe { as_cloneable_grenad(&c) })?;
tracing::warn!("Do we have a geojson");
if settings_diff.reindex_geojson() {
tracing::warn!("Yes we do");
let documents_chunk_cloned = original_documents_chunk.clone();
let lmdb_writer_sx_cloned = lmdb_writer_sx.clone();
let settings_diff = settings_diff.clone();