Added query parameter API to plugin server
Change-Id: I8f79aeab8d281ac02f9a1b490351f020556ffcfb
diff --git a/dev/demo/export.html b/dev/demo/export.html
index 4de4ad5..ebd9539 100644
--- a/dev/demo/export.html
+++ b/dev/demo/export.html
@@ -15,7 +15,8 @@
<script data-main="export.js" src="../js/lib/require.js" async="async"></script>
</head>
<body>
- <p>To run this demo start the <a href= https://korap.ids-mannheim.de/gerrit/admin/repos/KorAP/KalamarExportPlugin> Plugin Server</a> as Java Application or with the jar file in the /target folder.</p>
+ <p>To run this demo start the <a href= https://korap.ids-mannheim.de/gerrit/admin/repos/KorAP/KalamarExportPlugin> Plugin Server</a> as Java Application or with the jar file in the /target folder.</p>
+ <p>Click <a href="?q=Wasser&ql=poliqarp">?q=Wasser&ql=poliqarp</a> for a meaningful query.</p>
<div id="resultinfo" class="found"></div>
diff --git a/dev/js/src/plugin/server.js b/dev/js/src/plugin/server.js
index cb49364..f862770 100644
--- a/dev/js/src/plugin/server.js
+++ b/dev/js/src/plugin/server.js
@@ -415,7 +415,7 @@
};
}
- // Get Query form information
+ // Get Query information from from
else if (d.key == 'QueryForm') {
let doc = document;
let v = d["value"] = {};
@@ -430,6 +430,17 @@
if (el = KorAP.vc) {
v["cq"] = el.toQuery();
};
+ }
+
+ // Get Query information from parameters
+ else if (d.key == 'QueryParam') {
+
+ // Supported in all modern browsers
+ var p = new URLSearchParams(window.location.search);
+ let v = d["value"] = {};
+ v["q"] = p.get('q');
+ v["ql"] = p.get('ql');
+ v["cq"] = p.get('cq');
};
};