Select Git revision
search.pm 12.53 KiB
package SLUB::LZA::TA::Command::search;
use SLUB::LZA::TA -command;
use strict;
use warnings;
use feature qw(say);
use SLUB::LZA::TA::Archivematica::Elasticsearch;
use Data::Printer;
use constant VALUE_TERMINATOR => 0xff;
use constant NULL => 0xfe;
use constant ROW_TERMINATOR => 0xfd;
use constant CHR_VALUE_TERMINATOR => chr(VALUE_TERMINATOR);
use constant CHR_NULL => chr(NULL);
use constant CHR_ROW_TERMINATOR => chr(ROW_TERMINATOR);
use List::Util qw(any none);
use Date::Calc qw(Date_to_Time);
# VERSION
# ABSTRACT: search IEs module for ta-tool
sub abstract {"searches Archival Information System (AIS)";}
my $description=<<"DESCR";
Searches an AIS for descriptive or source metadata on behalf of the Technical Analyst.
Returns AIP id. Only the first 10 matches will be presented by default.
Examples:
* Which AIP has this dc identifier?
'$0 search -d SLUB:LZA:Kitodo:kitodo:422766'
* Which AIPs are public domain?
'$0 search -s publicdomain'
* Which AIPs are copyrighted?
'$0 search -s copyrighted'
* Which AIPs were created in 2021-05-31?
'$0 search -c 2021-05-31'
* Which AIPs with mkv-files are in archive?
'$0 search --pronom-format fmt/569'
* Which AIP has this dc identifier? Print the AIP id, lzaid of matching AIP
as Rows of String Values (RSV)
'$0 search -d SLUB:LZA:Kitodo:kitodo:422766 --with-lzaid --output-as-rsv'
DESCR
sub description {
"$description"
}
sub opt_spec {
return (
[ 'debug' => 'enable user agent debug output' ],
[ 'output-format' => hidden => {
one_of => [
[ 'output-as-csv|C' => 'prints output as Comma Separated Values (CSV)' ],
[ 'output-as-raw|R' => 'enable full elasticsearch response' ],
[ 'output-as-rsv|r' => 'prints output as Raw Strings Values (RSV) [default]' ],
],
}
],
[],
[ 'aip|a=s' => 'search a specific AIP by given AIP id' ],
[ 'datemode' => hidden => {
one_of => [
[ 'creationdate|c=s' => 'search based on creation date, use format YYYY-MM-DD' ],
#[ 'modificationdate|m=s' => 'search based on modificationdate string' ]
]
}
],
[ 'descriptive|d=s', 'search descriptive metadata (dc identifier)' ],
[ 'lzaid|l=s', 'search a specific AIP by given LZA id' ],