Skip to content

Commit

Permalink
Attempt to fix traversal logic
Browse files Browse the repository at this point in the history
  • Loading branch information
TimDiekmann committed Oct 17, 2024
1 parent d46005f commit 0f2f8ee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,11 @@ where
TimeAxis::TransactionTime => ("decision_time", "transaction_time"),
};

let table = if depth == Some(0) {
"entity_is_of_type"
} else {
"closed_entity_is_of_type"
};

let where_statement = match depth {
Some(depth) if depth != 0 => Cow::Owned(format!(
let where_statement = depth.map_or(Cow::Borrowed(""), |depth| {
Cow::Owned(format!(
"WHERE closed_entity_is_of_type.inheritance_depth <= {depth}"
)),
_ => Cow::Borrowed(""),
};
))
});

Ok(self
.client
Expand All @@ -131,11 +124,11 @@ where
AND source.web_id = filter.web_id
AND source.entity_uuid = filter.entity_uuid
JOIN {table}
ON source.entity_edition_id = {table}.entity_edition_id
JOIN closed_entity_is_of_type
ON source.entity_edition_id = closed_entity_is_of_type.entity_edition_id
JOIN ontology_ids
ON {table}.entity_type_ontology_id = ontology_ids.ontology_id
ON closed_entity_is_of_type.entity_type_ontology_id = ontology_ids.ontology_id
{where_statement};
"#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,7 @@ where

#[tracing::instrument(level = "info", skip(self))]
async fn reindex_entity_type_cache(&mut self) -> Result<(), UpdateError> {
tracing::info!("Reindexing data type cache");
tracing::info!("Reindexing entity type cache");
let transaction = self.transaction().await.change_context(UpdateError)?;

// We remove the data from the reference tables first
Expand Down

0 comments on commit 0f2f8ee

Please sign in to comment.