From 326ea6c89dca1c7e0691ae6eda7dac81a2b19666 Mon Sep 17 00:00:00 2001 From: David McKee Date: Wed, 30 Oct 2024 14:05:15 +0000 Subject: [PATCH] require published before bulk enrichment --- .../get_pending_enrichment_for_version.xqy | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/caselawclient/xquery/get_pending_enrichment_for_version.xqy b/src/caselawclient/xquery/get_pending_enrichment_for_version.xqy index dbc666a7..33dffa95 100644 --- a/src/caselawclient/xquery/get_pending_enrichment_for_version.xqy +++ b/src/caselawclient/xquery/get_pending_enrichment_for_version.xqy @@ -11,20 +11,26 @@ xdmp:to-json(xdmp:sql( "SELECT process_data.uri, enrich_version_string, minutes_since_enrichment_request FROM ( SELECT + propertysummary.published, process_data.uri, enrich_version_string, enrich_major_version, enrich_minor_version, parser_major_version, parser_minor_version, DATEDIFF('minute', last_sent_to_enrichment, CURRENT_TIMESTAMP) AS minutes_since_enrichment_request FROM documents.process_data JOIN documents.process_property_data ON process_data.uri = process_property_data.uri + JOIN documents.propertysummary ON process_data.uri = propertysummary.uri ) - WHERE ( - (enrich_version_string IS NULL) OR - (enrich_major_version <= @target_enrichment_major_version AND enrich_minor_version < @target_enrichment_minor_version) - ) AND ( - (parser_major_version = @target_parser_major_version AND parser_minor_version = @target_parser_minor_version) - ) - AND (minutes_since_enrichment_request > 43200 OR minutes_since_enrichment_request IS NULL) + WHERE + (minutes_since_enrichment_request > 43200 OR minutes_since_enrichment_request IS NULL) AND + (propertysummary.published = 'true') AND + ( enrich_version_string IS NULL + OR + ( + (enrich_major_version <= @target_enrichment_major_version AND enrich_minor_version < @target_enrichment_minor_version) + AND + (parser_major_version = @target_parser_major_version AND parser_minor_version = @target_parser_minor_version) + ) + ) ORDER BY enrich_major_version ASC NULLS FIRST, enrich_minor_version ASC LIMIT @maximum_records", "array",