-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make pending enrichment query aware of parser version
- Loading branch information
1 parent
9831ef5
commit 929f8c7
Showing
4 changed files
with
25 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 12 additions & 5 deletions
17
src/caselawclient/xquery/get_pending_enrichment_for_version.xqy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,35 @@ | ||
xquery version "1.0-ml"; | ||
|
||
declare variable $target_major_version as xs:int external; | ||
declare variable $target_minor_version as xs:int external; | ||
declare variable $target_enrichment_major_version as xs:int external; | ||
declare variable $target_enrichment_minor_version as xs:int external; | ||
declare variable $target_parser_major_version as xs:int external; | ||
declare variable $target_parser_minor_version as xs:int external; | ||
|
||
xdmp:to-json(xdmp:sql( | ||
"SELECT process_data.uri, enrich_version_string, minutes_since_enrichment_request | ||
FROM ( | ||
SELECT | ||
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 | ||
) | ||
WHERE ( | ||
(enrich_version_string IS NULL) OR | ||
(enrich_major_version <= @target_major_version AND enrich_minor_version < @target_minor_version) | ||
(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) | ||
ORDER BY enrich_major_version ASC NULLS FIRST, enrich_minor_version ASC", | ||
"array", | ||
map:new(( | ||
map:entry("target_major_version", $target_major_version), | ||
map:entry("target_minor_version", $target_minor_version) | ||
map:entry("target_enrichment_major_version", $target_enrichment_major_version), | ||
map:entry("target_enrichment_minor_version", $target_enrichment_minor_version), | ||
map:entry("target_parser_major_version", $target_parser_major_version), | ||
map:entry("target_parser_minor_version", $target_parser_minor_version) | ||
)) | ||
)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters