summaryrefslogtreecommitdiffstats
path: root/container-search-gui/src/main/resources/gui/_includes
diff options
context:
space:
mode:
Diffstat (limited to 'container-search-gui/src/main/resources/gui/_includes')
-rw-r--r--container-search-gui/src/main/resources/gui/_includes/css/vespa.css4
-rw-r--r--container-search-gui/src/main/resources/gui/_includes/index.html193
-rw-r--r--container-search-gui/src/main/resources/gui/_includes/search-api-reference.html12
3 files changed, 100 insertions, 109 deletions
diff --git a/container-search-gui/src/main/resources/gui/_includes/css/vespa.css b/container-search-gui/src/main/resources/gui/_includes/css/vespa.css
index 42cf0d1bd9d..24cfd32cbb2 100644
--- a/container-search-gui/src/main/resources/gui/_includes/css/vespa.css
+++ b/container-search-gui/src/main/resources/gui/_includes/css/vespa.css
@@ -1,3 +1,7 @@
+/**
+* Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+* Based on vespa.css from https://github.com/vespa-engine/frontpage for header- and footer-elements
+*/
:root{
--primary: #188fff;
--secondary: #003abc;
diff --git a/container-search-gui/src/main/resources/gui/_includes/index.html b/container-search-gui/src/main/resources/gui/_includes/index.html
index 80287979c53..85de6c68cf4 100644
--- a/container-search-gui/src/main/resources/gui/_includes/index.html
+++ b/container-search-gui/src/main/resources/gui/_includes/index.html
@@ -1,3 +1,4 @@
+<!-- Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
<!DOCTYPE html>
<html>
<head>
@@ -9,6 +10,7 @@
search applications, ad selection system, personalized
recommendation systems, and more...">
+
<!-- Site icons - generated using http://realfavicongenerator.net/ -->
<link rel="apple-touch-icon" sizes="180x180" href="/querybuilder/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/querybuilder/icons/favicon-32x32.png">
@@ -19,23 +21,13 @@
<meta name="msapplication-config" content="/querybuilder/icons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
- <!-- Custom CSS & Bootstrap Core CSS - Uses Bootswatch Flatly Theme: http://bootswatch.com/flatly/ -->
-
<!-- Custom Fonts -->
<link rel="stylesheet" href="/querybuilder/css/font-awesome/css/font-awesome.min.css">
- <!-- <link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css"> -->
<link href='https://fonts.googleapis.com/css?family=Kaushan+Script' rel='stylesheet' type='text/css'>
<link href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic" rel="stylesheet" type="text/css">
<link href='https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700' rel='stylesheet' type='text/css'>
-
- <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
- <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
- <!--[if lt IE 9]>
- <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
- <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
- <![endif]-->
<title>Vespa - Big Data. Real time.</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
@@ -43,10 +35,6 @@
<meta name="description" content="">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
- <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
- <!--[if lt IE 9]>
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
- <![endif]-->
</head>
@@ -83,9 +71,7 @@
<li><a href="http://docs.vespa.ai/documentation/vespa-quick-start.html">Get Started Now</a>
</ul>
</div>
- <!-- /.navbar-collapse -->
</div>
- <!-- /.container-fluid -->
</nav>
<!-- Header -->
@@ -209,37 +195,39 @@
var searchApiReference = null;
window.onload = function() {addNewRow(); getSearchApiReference();};
- var possible = ["yql", "hits", "offset", "queryProfile", "nocache", "groupingSessionCache", "searchChain", "timeout", "trace", "",
- , "model", "ranking", "presentation", "pos", "streaming", "rules", "recall", "user", "nocachewrite", "metrics"];
+ var possible = ["yql", "hits", "offset", "queryProfile", "nocache", "groupingSessionCache", "searchChain", "timeout", "trace","tracelevel","traceLevel", "",
+ , "model", "ranking", "collapse","collapsesize","collapsesize","presentation", "pos", "streaming", "rules", "recall", "user", "nocachewrite", "metrics"];
var usedProps = [];
- var hasChilds = ["model", "ranking", "trace", "matchPhase", "diversity", "presentation","collapse", "pos", "streaming", "rules"];
+ var hasChilds = ["model", "ranking", "trace","tracelevel", "ranking.matchPhase", "ranking.matchPhase.diversity", "presentation","collapse", "pos", "streaming", "rules", "metrics"];
var removedIndexes = [0];
var childrenProps = {
"model" : ["defaultIndex", "encoding", "language", "queryString", "restrict", "searchPath", "sources", "type"],
"ranking" : ["location", "features", "listFeatures", "profile", "properties", "sorting", "freshness", "queryCache", "matchPhase"],
- "matchPhase" : ["maxHits", "attribute", "ascending", "diversity"],
- "diversity" : ["attribute", "minGroups"],
+ "ranking.matchPhase" : ["maxHits", "attribute", "ascending", "diversity"],
+ "ranking.matchPhase.diversity" : ["attribute", "minGroups"],
"presentation" : ["bolding", "format", "summary", "template", "timing"],
- "trace" : ["level", "timestamps", "rules"],
+ "trace" : ["timestamps"],
+ "tracelevel" : ["rules"],
"metrics" : ["ignore"],
- "collapse":["field", "size", "summary"],
+ "collapse":["summary"],
"pos" : ["ll", "radius", "bb", "attribute"],
"streaming" : ["userid", "groupname", "selection", "priority", "maxbucketspervisitor"],
"rules" : ["off", "rulebase"]
};
- var stringType = ["yql", "queryProfile", "searchChain", "defaultIndex", "encoding", "language",
- "queryString", "searchPath", "type", "features", "profile", "properties", "sorting", "attribute", "summary",
- "template", "select", "field", "summary", "ll", "radius", "priority", "groupname", "selection", "rulebase",
- "user", "format"];
- var booleanType = ["nocache", "groupingSessionCache", "timestamps", "listFeatures", "queryCache", "ascending",
- "bolding", "timing", "off", "nocachewrite", "ignore"];
- var listType = ["filter", "restrict", "sources", "bb", "recall"];
- var integerType = ["hits","offset", "level", "freshness", "collapsesize", "userid", "maxbucketspervisitor", "rules"];
+ var stringType = ["yql", "queryProfile", "searchChain", "model.defaultIndex", "model.encoding", "model.language",
+ "model.queryString", "model.searchPath", "model.type", "ranking.features", "ranking.profile", "ranking.properties", "ranking.sorting", "ranking.matchPhase.diversity.attribute",
+ "ranking.matchPhase.attribute","pos.attribute", "presentation.summary", "collapse.summary",
+ "presentation.template", "select", "collapsefield", "pos.ll", "pos.radius", "streaming.priority", "streaming.groupname", "streaming.selection", "rules.rulebase",
+ "user", "presentation.format","ranking.location","ranking.freshness"];
+ var booleanType = ["nocache", "groupingSessionCache", "trace.timestamps", "ranking.listFeatures", "ranking.queryCache", "ranking.matchPhase.ascending",
+ "presentation.bolding", "presentation.timing", "rules.off", "nocachewrite", "metrics.ignore"];
+ var listType = ["model.filter", "model.restrict", "model.sources", "pos.bb", "recall"];
+ var integerType = ["hits","offset", "traceLevel", "collapsesize", "streaming.userid", "streaming.maxbucketspervisitor", "tracelevel.rules"];
var floatType = ["timeout"];
- var longType = ["maxHits", "minGroups"];
- var latlongType = ["location"];
+ var longType = ["ranking.matchPhase.maxHits", "ranking.matchPhase.diversity.minGroups"];
+ var latlongType = [""];
var yqlID = "v1";
@@ -364,7 +352,6 @@
return string;
}
-
function dotNotate(obj,target,prefix) {
target = target || {},
prefix = prefix || "";
@@ -386,8 +373,6 @@
clearSelection();
}
-
-
function clearSelection()
{
if (window.getSelection) {window.getSelection().removeAllRanges();}
@@ -405,12 +390,10 @@
function changeDiv(selectedMethod){
if (selectedMethod === "GET"){
- console.log(selectedMethod);
document.getElementById("request").innerHTML = '</br><textarea class=\"responsebox\" cols=70 rows=4 id=\"url2\">'+copyURL();+'</textarea>';
changeVisibility();
}
else if (selectedMethod === "POST") {
- console.log(selectedMethod);
document.getElementById("request").innerHTML = "</br> <div class=\"intro-param\">Construct a query by adding parameters or pasting a JSON.</div>";
number = 0;
changeVisibility();
@@ -507,7 +490,7 @@
function showInformation(no, key){
var a = document.getElementById("inf"+no);
- if(validKey(key)){
+ if(validKey(no, key)){
a.style = "visibility: visible;";
try {
document.getElementById("span"+no).innerHTML = changeInformation(no, key);
@@ -520,10 +503,10 @@
}
}
- function validKey(possibleKey){
+ function validKey(no, possibleKey){
if (contains(possible, possibleKey)){return true;}
for (var key in childrenProps){
- if (contains(childrenProps[key],possibleKey )){
+ if (contains(childrenProps[key],possibleKey)){
return true;
}
}
@@ -534,7 +517,8 @@
var key = document.getElementById("i"+no).value;
showInformation(no, key);
findUsedProps();
- if(contains(hasChilds, key)){
+ var fullKey = getFullName(no, key);
+ if(contains(hasChilds, fullKey)){
var input = document.getElementById("v"+no);
if ($(input).is("textarea")){
editAreaLoader.delete_instance(window.yqlID);
@@ -626,13 +610,13 @@
}
}
- if (!validKey(key)){
+ if (!validKey(no, key)){
var keyInput = document.getElementById("i"+no);
keyInput.style = "border-width: 1px; border-color: red;"
var valueInput = document.getElementById("v"+no);
valueInput.placeholder = "Invalid parameter";
}
- if (validKey(key)){
+ if (validKey(no, key)){
var keyInput = document.getElementById("i"+no);
keyInput.style = "border-width: 0px;"
}
@@ -641,6 +625,7 @@
function showType(inputVal, no){
var key = document.getElementById("i"+no).value;
+ var key = getFullName(no, key);
if (contains(stringType, key)){
inputVal.placeholder = "String";
}
@@ -671,7 +656,9 @@
var div = document.getElementById(no);
var key = document.getElementById("i"+no).value;
var bigdiv = document.getElementById("request");
- bigdiv.removeChild(div);
+ setTimeout(function(){
+ bigdiv.removeChild(div);
+ }, 200);
removedIndexes.push(no);
findUsedProps();
updateFields();
@@ -681,15 +668,8 @@
function removeChild(no){
var a = "" + no;
var parentIndexes;
- var length = no.length;
- switch (length) {
- case 2: parentIndexes = 1; break;
- case 3: parentIndexes = 2; break;
- case 4: parentIndexes = 3; break;
- case 5: parentIndexes = 4; break;
- }
var div = document.getElementById(no);
- var bigdiv = document.getElementById(no.substr(0,parentIndexes));
+ var bigdiv = document.getElementById(a.split(".").slice(0, -1).join("."));
bigdiv.removeChild(div);
removedIndexes.push(parseInt(no));
findUsedProps();
@@ -697,10 +677,14 @@
generateJSON();
}
+ function countDots(s1) {
+ return ( s1.match( /\./g ) || [] ).length;
+ }
+
function addChildProp(no, key, value){
generateJSON();
childno[no] += 1;
- var temp = ""+no+childno[no];
+ var temp = ""+no+"."+childno[no];
childno[temp] = 0;
var parentNode = document.getElementById(no);
@@ -739,19 +723,16 @@
var span = document.createElement("span");
span.id = "span"+temp;
span.innerHTML = stripMyHTML('Choose a parameter for information');
-
var a = document.createElement("a");
a.href = "#";
a.classList.add("tip");
a.id = "inf"+temp
-
a.appendChild(img);
a.appendChild(span);
-
div.appendChild(b);
div.appendChild(newInput);
- div.appendChild(newDatalist);3
- div.append(a)
+ div.appendChild(newDatalist);
+ div.append(a);
div.appendChild(newInputVal);
div.appendChild(newButton);
div.appendChild(br);
@@ -760,7 +741,7 @@
let value2 = "" + value;
if (key){
newInput.value = key;
- keySelected(temp, value)
+ keySelected(temp, value);
}
if (value2==="false" || value){
newInputVal.value= value;
@@ -769,19 +750,20 @@
}
function updateChildrenFields(parentNo){
- parentKey = document.getElementById("i"+parentNo).value
- var temp = parseInt(""+parentNo+childno[parentNo]);
- var minNumber = parseInt(""+parentNo+0);
- while (temp > minNumber){
+ parentKey = document.getElementById("i"+parentNo).value;
+ var temp = parseInt(childno[parentNo]);
+ while (temp > 0){
if (!contains(removedIndexes, temp)){
- var datalist = document.getElementById("prop"+temp);
- datalist.innerHTML = "";
- var list = childrenProps[parentKey];
- list.forEach(function(item){
- var option = document.createElement("option");
- option.value = item;
- datalist.appendChild(option);
- });
+ var datalist = document.getElementById("prop"+parentNo+"."+temp);
+ setTimeout(function(){
+ datalist.innerHTML = "";
+ var list = childrenProps[getFullName(parentNo,parentKey)];
+ list.forEach(function(item){
+ var option = document.createElement("option");
+ option.value = item;
+ datalist.appendChild(option);
+ });
+ }, 30);
}
temp -= 1;
}
@@ -800,22 +782,26 @@
document.location.reload(true);
}
-
function generateJSON(){
json = JSON.parse("{}");
buildJSON(json, number, 0);
var textarea = document.getElementById("jsonquery");
textarea.innerHTML = JSON.stringify(window.json, undefined, 4);
- console.log("Build json: "+JSON.stringify(json));
}
function buildJSON(parent, no, thresh){
var temp = no;
- while (temp > thresh){
+ if (countDots(""+temp) > 0){
+ var list = (""+no).split(".");
+ var child_id = list[list.length-1];
+ } else{
+ var child_id = (""+no)
+ }
+ while (child_id > thresh){
if (!contains(removedIndexes, temp)){
var key = document.getElementById("i"+temp).value;
if (document.getElementById("v"+temp) != null){
- var value = document.getElementById("v"+temp).value
+ var value = document.getElementById("v"+temp).value;
if (key === "yql"){
value = $.trim(editAreaLoader.getValue(window.yqlID).replace(/\n/g, " "));
}
@@ -825,11 +811,12 @@
} if (value === 'false'){
value = false;
}}
- if (contains(integerType, key) || contains(longType, key)){
+ var fullKey = getFullName(temp, key);
+ if (contains(integerType, fullKey) || contains(longType, fullKey)){
value = parseInt(value);
value = isNaN(value) ? 0 : value;
}
- if (contains(floatType, key)){
+ if (contains(floatType, fullKey)){
value = parseFloat(value);
value = isNaN(value) ? 0 : value;
}
@@ -838,18 +825,29 @@
parent[key] = JSON.parse("{}");
const newParent = parent[key];
const tempJSON = json;
- var newNo = parseInt(""+temp+childno[temp]);
- var newThresh = parseInt(""+temp+0);
+ var newNo = temp+"."+childno[temp];
+ var newThresh = 0;
buildJSON(newParent, newNo, newThresh);
}
}
- temp --;
+ if (countDots(""+temp) > 0){
+ var temp2 = temp.split(".").slice(0, -1);
+ var newNo = temp.split(".")[temp2.length];
+ newNo = parseInt(newNo)-1;
+ temp2.push(newNo);
+ temp = temp2.join(".");
+ child_id--;
+ } else{
+ temp = parseInt(temp)-1;
+ child_id--;
+ }
}
}
function findUsedProps(){
usedProps = [];
- addUsedProps(number, 0);
+ addUsedProps(window.number, 0);
+
}
function addUsedProps(no, thresh){
@@ -858,22 +856,16 @@
if (!contains(removedIndexes, temp)){
var key = document.getElementById("i"+temp).value;
usedProps.push(key);
- if (childno[temp] != -1){
- var temp2 = parseInt(""+temp+childno[temp]);
- var thresh2 = parseInt(""+temp+0);
- addUsedProps(temp2, thresh2);
- }
}
- temp--;
+ temp--;
}
}
-
function startSending(){
if (method === "POST"){
var url = document.getElementById("url").value;
generateJSON();
- var jsonobj = JSON.stringify(json);
+ var jsonobj = JSON.stringify(window.json);
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST", url, false);
xmlhttp.setRequestHeader("Content-Type", "application/json");
@@ -889,9 +881,9 @@
function changeVisibility() {
var x = document.getElementById("url");
- var y = document.getElementById("addRow")
- var z = document.getElementById("showJSON")
- var a = document.getElementById("pasteJSON")
+ var y = document.getElementById("addRow");
+ var z = document.getElementById("showJSON");
+ var a = document.getElementById("pasteJSON");
if (x.style.display === "none") {
x.style.display = "inline-block";
y.style.display = "inline-block";
@@ -905,7 +897,6 @@
}
}
-
function showJSON(){
var textarea = document.getElementById("jsonquery");
var copyJSON = document.getElementById("copyJSON");
@@ -923,9 +914,8 @@
showJSON.innerHTML = "Show query JSON";
copyURL.style.display = "none";
}
-
-
}
+
function getSearchApiReference(){
var div = document.getElementById("div");
var object = document.createElement("object");
@@ -943,11 +933,9 @@
function changeInformation(no,key){
if (key===""){return "Choose a parameter for information"}
- if (contains(hasChilds, key)){return "Add parameters under the parent ''" + getFullName(no,key) + "'"}
- var refId = getFullName(no,key)
+ if (contains(hasChilds, getFullName(no,key))){return "Add parameters under the parent ''" + getFullName(no,key) + "'"}
+ var refId = getFullName(no,key);
var ref = searchApiReference;
- //var tag = document.createElement('div');
- //tag.appendChild(ref.getElementById(refId).nextElementSibling);
var tabletext = stripMyHTML(ref.getElementById(refId).nextElementSibling.outerHTML);
return tabletext;
}
@@ -955,15 +943,14 @@
function getFullName(no, key){
var name = key;
no = ""+no;
- no = no.substring(0,(no.length - 1));
+ no = no.split(".").slice(0,-1).join(".");
while (no.length > 0){
var parentName = document.getElementById("i"+no).value;
name = parentName + "." + name;
- no = no.substring(0,(no.length - 1));
+ no = no.split(".").slice(0,-1).join(".");
}
return name;
}
-
</script>
<!-- Global Site Tag (gtag.js) - Google Analytics -->
diff --git a/container-search-gui/src/main/resources/gui/_includes/search-api-reference.html b/container-search-gui/src/main/resources/gui/_includes/search-api-reference.html
index fc5b1983e55..195c9dc2663 100644
--- a/container-search-gui/src/main/resources/gui/_includes/search-api-reference.html
+++ b/container-search-gui/src/main/resources/gui/_includes/search-api-reference.html
@@ -1,5 +1,5 @@
---
-# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+# Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
title: "Vespa Search API reference"
---
@@ -124,7 +124,7 @@ get methods as Java objects from the Query to Searcher components.
<ul>
<li><a href="#rules.off">rules.off</a></li>
<li><a href="#rules.rulebase">rules.rulebase</a></li>
- <li><a href="#trace.rules">trace.rules</a></li>
+ <li><a href="#tracelevel.rules">tracelevel.rules</a></li>
</ul>
</dd>
@@ -292,9 +292,9 @@ search chain may invoke other chains.
<p>The query timeout.</p>
-<h3 id="trace.level">trace.level</h3>
+<h3 id="tracelevel">tracelevel</h3>
<table class="table table-striped">
-<tr><td>Alias</td>tracelevel<td></td></tr>
+<tr><td>Alias</td><td></td></tr>
<tr><td>Values</td>
<td>
Any positive number
@@ -940,9 +940,9 @@ Refer to <a href="semantic-rules.html">semantic rules</a>.
<p>The name of the rule base to use for these queries</p>
-<h3 id="trace.rules">trace.rules</h3>
+<h3 id="tracelevel.rules">tracelevel.rules</h3>
<table class="table table-striped">
-<tr><td>Alias</td><td>tracelevel.rules</td></tr>
+<tr><td>Alias</td><td></td></tr>
<tr><td>Values</td><td>int</td></tr>
<tr><td>Default</td><td>1-5 (?)</td></tr>
</table>