aboutsummaryrefslogtreecommitdiffstats
path: root/container-search-gui
diff options
context:
space:
mode:
authorHenrik <henrik.hoiness@online.no>2018-07-18 13:21:45 +0200
committerHenrik <henrik.hoiness@online.no>2018-07-18 13:21:45 +0200
commite641f0f1eafb9f48112dba5fe6255843662a9655 (patch)
treecc02cb6f670821b31e1ec0abb8c8f9cae98b31da /container-search-gui
parent8874c5506eaaf6bd09c0d01daa754c8d8524ef32 (diff)
parent205f33ed11edfbc1021f05c0f54fdafa687af154 (diff)
Solved conflict and added all changes from the PR that was reverted
Diffstat (limited to 'container-search-gui')
-rw-r--r--container-search-gui/src/main/java/com/yahoo/search/query/gui/GUIHandler.java7
-rw-r--r--container-search-gui/src/main/resources/gui/_includes/index.html94
2 files changed, 34 insertions, 67 deletions
diff --git a/container-search-gui/src/main/java/com/yahoo/search/query/gui/GUIHandler.java b/container-search-gui/src/main/java/com/yahoo/search/query/gui/GUIHandler.java
index 280fba3a4bb..45a616ce473 100644
--- a/container-search-gui/src/main/java/com/yahoo/search/query/gui/GUIHandler.java
+++ b/container-search-gui/src/main/java/com/yahoo/search/query/gui/GUIHandler.java
@@ -35,7 +35,6 @@ import java.util.List;
import java.util.logging.Level;
-
/**
* Takes requests on /querybuilder
*
@@ -43,6 +42,7 @@ import java.util.logging.Level;
*/
public class GUIHandler extends LoggingRequestHandler {
+
private final IndexModel indexModel;
private final RankProfilesConfig rankProfilesConfig;
@@ -88,13 +88,12 @@ public class GUIHandler extends LoggingRequestHandler {
InputStream in = GUIHandler.class.getClassLoader().getResourceAsStream("gui/"+path);
boolean isValid = (in != null);
if(isValid){
- try { in.close(); } catch (IOException e) {/* Problem with closing input stream */}
+ try { in.close(); } catch (IOException e) {/* Problem with closing inputstream */}
}
return isValid;
}
-
private static class FileResponse extends HttpResponse {
private final String path;
@@ -106,8 +105,8 @@ public class GUIHandler extends LoggingRequestHandler {
this.path = relativePath;
this.indexModel = indexModel;
this.rankProfilesConfig = rankProfilesConfig;
- }
+ }
@Override
public void render(OutputStream out) throws IOException {
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 ae6558d8f53..ca3302dd404 100644
--- a/container-search-gui/src/main/resources/gui/_includes/index.html
+++ b/container-search-gui/src/main/resources/gui/_includes/index.html
@@ -84,7 +84,7 @@
<option class="options" value="POST">POST</option>
<option class="options" value="GET">GET</option>
</select>
- <input type="text" class="textbox" name="value" value="http://localhost:8080/search/" id="url" size="30">
+ <input type="text" class="textbox" name="value" value="http://httpbin.org/post" id="url" size="30">
<button class="button" onclick="startSending();" id="send">Send</button>
<br/>
@@ -184,36 +184,48 @@
+
+
<SCRIPT language="javascript">
- const CONFIG = $.getJSON('/querybuilder/config.json', function(data){window.CONFIG = data;});
+ const CONFIG = $.getJSON('/querybuilder/gui_variables.json', function(data){window.CONFIG = data;});
method = "POST";
var number = 0;
var childno = {};
var json = JSON.parse("{}");
var searchApiReference = null;
- var possible = null;
+
+ 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 removedIndexes = [0];
- var childrenProps = null;
-
+ var childrenProps = {
+ "model" : ["defaultIndex", "encoding", "language", "queryString", "restrict", "searchPath", "sources", "type"],
+ "ranking" : ["location", "features", "listFeatures", "profile", "properties", "sorting", "freshness", "queryCache", "matchPhase"],
+ "ranking.matchPhase" : ["maxHits", "attribute", "ascending", "diversity"],
+ "ranking.matchPhase.diversity" : ["attribute", "minGroups"],
+ "presentation" : ["bolding", "format", "summary", "template", "timing"],
+ "trace" : ["timestamps"],
+ "tracelevel" : ["rules"],
+ "metrics" : ["ignore"],
+ "collapse":["summary"],
+ "pos" : ["ll", "radius", "bb", "attribute"],
+ "streaming" : ["userid", "groupname", "selection", "priority", "maxbucketspervisitor"],
+ "rules" : ["off", "rulebase"]
+ };
window.onload = function() {
- setTimeout(function(){
- possible = window.CONFIG.levelZeroParameters;
- childrenProps = window.CONFIG.childMap;
-
- if (window.CONFIG.hasOwnProperty("ranking_features")){
- childrenProps["ranking.features"] = window.CONFIG.ranking_features;
- }
- if (window.CONFIG.hasOwnProperty("ranking_properties")){
- childrenProps["ranking.properties"] = window.CONFIG.ranking_properties;
- }
-
+ // Adding variables from configuration file
+ if (window.CONFIG.hasOwnProperty("featurename")){
+ childrenProps["ranking.features"] = window.CONFIG.featurename;
+ }
+ if (window.CONFIG.hasOwnProperty("propertyname")){
+ childrenProps["ranking.properties"] = window.CONFIG.propertyname;
+ }
- addNewRow();
- getSearchApiReference();
- }, 250);
+ addNewRow();
+ getSearchApiReference();
};
var stringType = ["yql", "queryProfile", "searchChain", "model.defaultIndex", "model.encoding", "model.language",
@@ -427,17 +439,10 @@
newInput.classList.add("input")
var newDatalist = document.createElement("datalist");
newDatalist.id = "prop"+temp;
-
newInputVal = document.createElement("input");
newInputVal.type = "text";
newInputVal.id = "v"+temp;
newInputVal.classList.add("propvalue");
- newInputVal.setAttribute("list", "val"+temp);
- var newDatalist2 = document.createElement("datalist");
- newDatalist2.id = "val"+temp;
- //newDatalist2.style = "display: none;";
-
-
var newButton = document.createElement("button");
newButton.id = "b"+temp;
newButton.innerHTML = "-";
@@ -473,7 +478,6 @@
div.appendChild(a);
div.appendChild(newInputVal);
- div.appendChild(newDatalist2);
div.appendChild(newButton);
div.appendChild(br);
@@ -521,23 +525,6 @@
return false;
}
-
- function checkConfigOptions(key, no){
- var jsonID = key.replace(/\./g , "_");
- var datalist = document.getElementById("val"+no);
- datalist.innerHTML = "";
- if (window.CONFIG.hasOwnProperty(jsonID)){
- var optionlist = eval("window.CONFIG."+jsonID);
- optionlist.forEach(function(item){
- var option = document.createElement("option");
- option.value = item;
- datalist.appendChild(option);
- });
-
- }
-
- }
-
function keySelected(no, value){
var key = document.getElementById("i"+no).value;
showInformation(no, key);
@@ -549,10 +536,6 @@
editAreaLoader.delete_instance(window.yqlID);
}
var button = document.createElement("button");
-
- //var datalist = document.getElementById("val"+no); //Hide value-datalist
- //datalist.style = "display:none;";
-
button.id="propb"+no
button.innerHTML=" + Add property";
button.onclick = function(){addChildProp(no);};
@@ -566,8 +549,6 @@
newInputVal.type = "text";
newInputVal.id = "v"+no;
newInputVal.classList.add("propvalue");
- newInputVal.setAttribute("list", "val"+no);
-
var parent = button.parentNode;
showType(newInputVal, no);
if (key === "yql"){
@@ -605,7 +586,6 @@
newInputVal.type = "text";
newInputVal.id = "v"+no;
newInputVal.classList.add("propvalue");
- newInputVal.setAttribute("list", "val"+no);
showType(newInputVal, no);
var parent = inputval.parentNode;
parent.replaceChild(newInputVal, inputval);
@@ -647,14 +627,8 @@
//keyInput.style = "border-width: 1px; border-color: red;"
var valueInput = document.getElementById("v"+no);
valueInput.placeholder = "Possible invalid parameter";
-
- //Removes possible options for for former parameter
- var datalist = document.getElementById("val"+no);
- datalist.innerHTML = "";
}
if (validKey(no, key)){
- // Check if datalist should be visible and add options
- checkConfigOptions(fullKey, no);
var keyInput = document.getElementById("i"+no);
//keyInput.style = "border-width: 0px;"
}
@@ -738,11 +712,6 @@
newInputVal.type = "text";
newInputVal.id = "v"+temp;
newInputVal.classList.add("propvalue");
-
- newInputVal.setAttribute("list", "val"+temp);
- var newDatalist2 = document.createElement("datalist");
- newDatalist2.id = "val"+temp;
-
var newButton = document.createElement("button");
newButton.id = "b"+temp;
newButton.innerHTML = "-";
@@ -777,7 +746,6 @@
div.appendChild(newDatalist);
div.append(a);
div.appendChild(newInputVal);
- div.appendChild(newDatalist2);
div.appendChild(newButton);
div.appendChild(br);
parentNode.appendChild(div);