Adjustments to match template for new Krill API
diff --git a/dev/js/src/match.js b/dev/js/src/match.js
index d3aee67..f6fbd41 100644
--- a/dev/js/src/match.js
+++ b/dev/js/src/match.js
@@ -10,8 +10,9 @@
*/
define([
'match/info',
+ 'match/reference',
'util'
-], function (infoClass) {
+], function (infoClass, refClass) {
// Localization values
var loc = KorAP.Locale;
diff --git a/dev/js/src/match/reference.js b/dev/js/src/match/reference.js
new file mode 100644
index 0000000..978930c
--- /dev/null
+++ b/dev/js/src/match/reference.js
@@ -0,0 +1,27 @@
+/*
+ author, editor title, subTitle textSigle
+ in corpusAuthor (corpusEditor), corpusTitle, corpusSubTitle, corpusSigle
+ in docAuthor (docEditor), docTitle, docSubTitle, docSigle
+ publisher
+ reference
+ creationDate
+ foundries
+ keywords
+ textClass
+ textColumn
+ textDomain
+ textType
+ textTypeArt
+ textTypeRef
+ language
+ license
+ pages
+ pubDate
+ layerInfo
+ tokenSource
+ biblEditionStatement
+ fileEditionStatement
+*/
+define(function () {
+ return;
+});
diff --git a/dev/js/src/vc/array.js b/dev/js/src/vc/array.js
index 6473a48..f640ed2 100644
--- a/dev/js/src/vc/array.js
+++ b/dev/js/src/vc/array.js
@@ -1,36 +1,39 @@
define(function () {
return [
- ['author', 'string'],
- ['biblEditionStatement', 'string'],
- ['corpusAuthor', 'string'],
- ['corpusEditor', 'string'],
- ['corpusSigle', 'string'],
- ['corpusSubTitle', 'string'],
- ['corpusTitle', 'string'],
- ['creationDate', 'date'],
- ['docAuthor', 'string'],
- ['docEditor', 'string'],
- ['docSigle', 'string'],
- ['docSubTitle', 'string'],
- ['docTitle', 'string'],
- ['editor', 'string'],
- ['fileEditionStatement', 'string'],
- ['keywords', 'string'],
- ['language', 'string'],
- ['license', 'string'],
- ['pages', 'string'],
- ['pubDate', 'date'],
- ['publisher', 'string'],
- ['pubPlace', 'date'],
- ['reference', 'string'],
- ['subTitle', 'string'],
- ['textClass', 'string'],
- ['textColumn', 'string'],
- ['textDomain', 'string'],
- ['textSigle', 'string'],
- ['textType', 'string'],
- ['textTypeArt', 'string'],
- ['textTypeRef', 'string'],
- ['title', 'string']
+ // layerInfo // stored
+ // tokenSource // stored
+ ['author', 'string'], // text
+ // ['biblEditionStatement', 'string'], // stored
+ ['corpusAuthor', 'string'], // text
+ // ['corpusEditor', 'string'], // stored
+ ['corpusSigle', 'string'], // string
+ ['corpusSubTitle', 'string'], // text
+ ['corpusTitle', 'string'], // text
+ ['creationDate', 'date'], // int
+ ['docAuthor', 'string'], // text
+ // ['docEditor', 'string'], // stored
+ ['docSigle', 'string'], // string
+ ['docSubTitle', 'string'], // text
+ ['docTitle', 'string'], // text
+ // ['editor', 'string'], // stored
+ // ['fileEditionStatement', 'string'], // stored
+ ['foundries', 'string'], // keywords
+ ['keywords', 'string'], // keywords
+ ['language', 'string'], // string
+ ['license', 'string'], // string
+ // ['pages', 'string'], // stored
+ ['pubDate', 'date'], // int
+ // ['publisher', 'string'], // stored
+ ['pubPlace', 'date'], // string
+ // ['reference', 'string'], // stored
+ ['subTitle', 'string'], // text
+ ['textClass', 'string'], // keyword
+ ['textColumn', 'string'], // string
+ ['textDomain', 'string'], // string
+ ['textSigle', 'string'], // string
+ ['textType', 'string'], // string
+ ['textTypeArt', 'string'], // string
+ ['textTypeRef', 'string'], // string
+ ['title', 'string'] // text
]
});
diff --git a/lib/Kalamar/API.pm b/lib/Kalamar/API.pm
index 74dc1c4..4401b46 100644
--- a/lib/Kalamar/API.pm
+++ b/lib/Kalamar/API.pm
@@ -61,6 +61,7 @@
my %param = @_;
# Set context based on parameter
+ # base/s:p
$url->query({ context => $param{'context'} // 'paragraph' });
# Set path to search
@@ -515,13 +516,20 @@
# Cleanup single match
sub _map_match {
my $x = shift or return;
- $x->{ID} =~ s/^match\-[^!]+![^-]+-//;
- $x->{docID} =~ s/^[^_]+_//;
+ $x->{matchID} =~ s/^match\-(?:[^!]+!|[^_]+_)[^-]+-//;
+ (
+ $x->{corpusID},
+ $x->{docID},
+ $x->{textID}
+ ) = ($x->{textSigle} =~ /^([^_]+?)_+([^\.]+?)\.(.+?)$/);
+
+ # $x->{docID} =~ s/^[^_]+_//;
# Legacy: In old versions the text_id was part of the doc_id
- unless ($x->{textID}) {
- ($x->{docID}, $x->{textID}) = split '\.', $x->{docID};
- };
+ # unless ($x->{textID}) {
+ # ($x->{docID}, $x->{textID}) = split '\.', $x->{docID};
+ # };
+
$x;
};
diff --git a/templates/match.html.ep b/templates/match.html.ep
index f3b5474..c48da55 100644
--- a/templates/match.html.ep
+++ b/templates/match.html.ep
@@ -1,11 +1,15 @@
-% my $match = stash('match') || {};
-% my $id = $match->{corpusID} . '-' . $match->{docID} . '.' . $match->{textID} . '#' . $match->{ID};
+% use Mojo::JSON qw/encode_json/;
+% my $match = stash('match') || {};
+% my %match_data = %$match;
+% delete @match_data{qw/snippet startMore endMore field/};
+% my $id = $match->{textSigle} . '#' . $match->{matchID};
<li data-corpus-id="<%= $match->{corpusID} %>"
data-doc-id="<%= $match->{docID} %>"
data-text-id="<%= $match->{textID} %>"
- data-match-id="<%= $match->{ID} %>"
+ data-match-id="<%= $match->{matchID} %>"
%# TODO: This needs to be retrieved per match
- data-available-info="cnx/c=spans corenlp/ne=tokens corenlp/p=tokens mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens tt/l=tokens tt/p=tokens xip/c=spans"
+ data-available-info="<%= $match->{layerInfos} // $match->{layerInfo} // 'cnx/c=spans corenlp/ne=tokens corenlp/p=tokens mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens tt/l=tokens tt/p=tokens xip/c=spans' %>"
+ data-info="<%== b(encode_json(\%match_data))->decode->xml_escape %>"
id="<%= $id %>"\
<% if (current_route eq 'match') { %> class="active"<% } =%>>
<div>
@@ -17,9 +21,8 @@
<p class="ref">\
<% if ($match->{title}) { %><strong><%= $match->{title} %></strong><% }; %>\
<%= $match->{author} ? ' ' . loc('by') . ' ' . $match->{author} : '' %>\
-<% if ($match->{title} || $match->{author}) { %>;<% } %> \
-<%= loc('pubOn') %> <%= $match->{pubDate} %> \
-(<%= $id %>)\
-%# Add textClass
+% if ($match->{pubDate}) {
+ (<time datetime="<%= $match->{pubDate} %>"><%= $match->{pubDate} %></time>)\
+% };
</p>
</li>