Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tools for technical analysts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Digital Preservation
tools for technical analysts
Commits
516a127a
Commit
516a127a
authored
1 year ago
by
Andreas Romeyke
Browse files
Options
Downloads
Patches
Plain Diff
- added '--with-score'
- fixed output logic
parent
ead90c6b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/SLUB/LZA/TA/Command/search.pm
+6
-3
6 additions, 3 deletions
lib/SLUB/LZA/TA/Command/search.pm
with
6 additions
and
3 deletions
lib/SLUB/LZA/TA/Command/search.pm
+
6
−
3
View file @
516a127a
...
...
@@ -85,6 +85,7 @@ sub opt_spec {
[
"
with-filecount
"
=>
"
also returns AIPs file count
"
],
[
"
with-export2archive-date
"
=>
"
also returns AIP export to archive date
"
],
[
"
with-creationdate
"
=>
"
also returns AIP creation date
"
],
[
"
with-score
"
=>
"
also returns score of Elastic Search match (higher => better)
"],
[]
,
[
'
help|h
',
"
print usage message and exit
",
{
shortcircuit
=>
1
}
],
[
'
version|v
',
"
print version information
",
{
shortcircuit
=>
1
}
],
...
...
@@ -108,6 +109,7 @@ sub line_result_mapper {
if
(
defined
$opt
->
{
with_filecount
})
{
$line
{
filecount
}
=
$partial_result
->
{
_source
}
->
{
file_count
}
};
if
(
defined
$opt
->
{
with_export2archive_date
})
{
$line
{
export2archive_date
}
=
$partial_result
->
{
_source
}
->
{
transferMetadata
}
->
[
0
]
->
{'
SLUBArchiv-exportToArchiveDate
'}
};
if
(
defined
$opt
->
{
with_creation_date
})
{
$line
{
creation_date
}
=
$partial_result
->
{
_source
}
->
{
created
}
};
if
(
defined
$opt
->
{
with_score
})
{
$line
{
score
}
=
$partial_result
->
{
_score
}}
\
%line
;
}
...
...
@@ -136,9 +138,8 @@ sub execute {
my
@headers
=
sort
keys
%
{
$result
[
0
]};
my
$aip_only
=
List::Util::
none
{
$_
=~
m/^with/
}
keys
%
{
$opt
};
p
(
$opt
);
if
(
$opt
->
{
output_format
}
eq
'
output_as_raw
')
{
say
np
(
$response
);
}
elsif
(
$aip_only
or
(
$opt
->
{
output_format
}
eq
'
output_as_csv
')
)
{
if
(
!
exists
$opt
->
{
output_format
})
{
$opt
->
{
output_format
}
=
'
output_as_rsv
'
;}
if
(
$aip_only
or
(
$opt
->
{
output_format
}
eq
'
output_as_csv
')
)
{
say
join
("
,
",
@headers
);
say
join
("
\n
",
map
{
my
$line
=
$_
;
...
...
@@ -156,6 +157,8 @@ p($opt);
print
join
(
CHR_ROW_TERMINATOR
,
map
{
join
(
CHR_VALUE_TERMINATOR
,
values
%
{
$_
});
}
@result
);
print
CHR_ROW_TERMINATOR
;
binmode
(
STDOUT
,
'
:encoding(UTF-8)
');
}
elsif
(
$opt
->
{
output_format
}
eq
'
output_as_raw
')
{
say
np
(
$response
);
}
return
1
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment