Skip to content

Commit

Permalink
#25 Better indexing error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Polleps committed Feb 7, 2023
1 parent edd35d0 commit 79eb79a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions server/src/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,13 @@ pub fn add_all_resources(search_state: &SearchState, store: &Db) -> AtomicServer
.filter(|resource| !resource.get_subject().contains("/commits/"));

for resource in resources {
add_resource(search_state, &resource, store)?;
add_resource(search_state, &resource, store).map_err(|e| {
format!(
"Failed to add resource to search index: {}. Error: {}",
resource.get_subject(),
e
)
})?
}

search_state.writer.write()?.commit()?;
Expand All @@ -154,7 +160,7 @@ pub fn add_resource(
let mut doc = Document::default();
doc.add_json_object(
fields.propvals,
serde_json::from_str(&resource.to_json(store)?).map_err(|e| {
serde_json::from_str(&resource.to_json_ad()?).map_err(|e| {
format!(
"Failed to convert resource to json for search indexing. Subject: {}. Error: {}",
subject, e
Expand Down

0 comments on commit 79eb79a

Please sign in to comment.