Skip to content

Commit

Permalink
Merge pull request #755 from nationalarchives/FCL-138-published-only-…
Browse files Browse the repository at this point in the history
…bulk-enrichment

require published before bulk enrichment
  • Loading branch information
dragon-dxw authored Nov 7, 2024
2 parents 1cae37c + 326ea6c commit 0f6ff76
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/caselawclient/xquery/get_pending_enrichment_for_version.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 0f6ff76

Please sign in to comment.