function doSearch() { query(); searchForm = document.search.elements; submitForm = document.search; completeBound(); //Simple var t1 = searchForm[0].value = dwr.util.getValue("simpleWord"); var term1att = searchForm[1].value = "fullText"; //var filterForData = searchForm.filterForDataHidden.value = dwr.util.getValue("filterForData"); //var filterForData = searchForm.filterForDataHidden.value = true; //Keyword var t2 = searchForm[2].value = dwr.util.getValue("searchThis"); var keyword4att = searchForm[3].value = dwr.util.getValue("keywordText"); //op between terms var op = searchForm[4].value = dwr.util.getValue("keywordOP"); //keyword 2 var keyword5att = searchForm[5].value = dwr.util.getValue("keywordText2"); var t3 = searchForm[6].value = dwr.util.getValue("searchThis2"); //op between terms var op2 = searchForm[7].value = dwr.util.getValue("keywordOP2.2"); //keyword 3 var keyword5att = searchForm[8].value = dwr.util.getValue("keywordText3"); var t3 = searchForm[9].value = dwr.util.getValue("searchThis3"); //op between terms var op2 = searchForm[10].value = "and"; //Spatial var t3 = searchForm[11].value = dwr.util.getValue("complete"); var spatialatt1 = searchForm[12].value = $('input[name=coordType]:checked').val(); //Temporal var when = searchForm[13].value = dwr.util.getValue("dateTest"); var t4 = searchForm[14].value = dwr.util.getValue("startDate"); var temporalatt1 = searchForm[15].value = "beginDate"; if (when == "during") { var t5 = searchForm[16].value = dwr.util.getValue("endDate"); } else { var t5 = searchForm[16].value = dwr.util.getValue(""); } var temporalatt2 = searchForm[17].value = "endDate"; var sourceSelect = dwr.util.getValue("sources"); //var t6 = searchForm[15].value = sourceSelect; var sourcesLen = document.sourceValues.sources.options.length; for (var i=0; i < sourcesLen; i++) { var option = document.sourceValues.sources.options[i]; if (option.selected === true) { var newInput = document.createElement('input'); newInput.setAttribute('type','hidden'); newInput.setAttribute('name','term6'); newInput.setAttribute('value', option.value); document.search.appendChild(newInput); } } var term6attribute = searchForm['term6attribute'].value = "datasource"; // Term7 place keyword // var term7 = searchForm['term7'].value = dwr.util.getValue("placeKey"); // var term7att = searchForm['term7attribute'].value = "placeKey"; // Term8 datetype keyword var term8 = searchForm['term8'].value = dwr.util.getValue("datetype"); // Term9 place keyword // var term9 = searchForm['term9'].value = dwr.util.getValue("formats"); // var term9att = searchForm['term9attribute'].value = "presentationCat"; var maxrecords = searchForm['pageSize'].value = dwr.util.getValue("results"); var queryString = searchForm['queryString'].value = dwr.util.getValue("query"); // Operators|Conditions /*if (t1 != "" && t2 != "") { searchForm[2].value = "and"; } if (t2 != "" && t3 != "") { searchForm[5].value = "and"; } else { searchForm[5].value = ""; } if (t3 != "" && t4 != "") { searchForm[8].value = "and"; } if (t4 != "") { searchForm[14].value = "and"; }*/ //Alert user if no query string is entered! var temporalPeriod = document.getElementById("dateTest").value; var temporalStart = dwr.util.getValue("startDate"); var temporalEnd = dwr.util.getValue("endDate"); if ((temporalStart != "" && temporalEnd == "") && temporalPeriod == "during") { alert("You have not entered End date"); } var tempTerm3 = t3.replace(/,/g,""); if (t1.trim() == "" && t2.trim() == "" && tempTerm3.trim() == "" && t4.trim() == "" && t5.trim() == "") { alert("No query has been entered!"); } else { msg = "SOLR - VARIABLES: Field Name(Type) = Value "; msg += "Total number of elements being passed = " + searchForm.length + ""; for (i = 0; i < searchForm.length; i++) { n = i % 3; if (n == 0) { msg += ""; } if(searchForm[i].value != "") { msg += " " + i + " - " + searchForm[i].name + "(" + searchForm[i].type + ") = '" + searchForm[i].value + "'" + "\n"; } } //alert(msg); //var win = window.open("", "nbiiStatusWindow", ""); //win.focus(); submitForm.submit(); } } function query() { var coordTypeNameArray = new Array("Overlaps", "Fully Enclosed by"); var queryString = ""; var simpleOn = false; var keywordOn = false; var spatialOn = false; var temporalOn = false; var sourceOn = false; var sourceOff = false; var formatOn = false; var placeOn = false; var lterSource = false; var simpleWord = document.getElementById("simpleWord").value; var keyAttribute = document.getElementById("keywordText").value; var keyAttribute2 = document.getElementById("keywordText2").value; var keyAttribute3 = document.getElementById("keywordText3").value; var keyTerm = document.getElementById("searchThis").value; var keyTerm2 = document.getElementById("searchThis2").value; var keyTerm3 = document.getElementById("searchThis3").value; var keyOP = document.getElementById("keywordOP").value; var keyOP2 = document.getElementById("keywordOP2.2").value; var spatialString = document.getElementById("complete").value; var spatialSelect = document.getElementById("placeList").value; var spatialSearch = dwr.util.getValue("coordType"); var temporalPeriod = document.getElementById("dateTest").value; var temporalStart = dwr.util.getValue("startDate"); var temporalEnd = dwr.util.getValue("endDate"); var sources = dwr.util.getValue("sources"); var dateType = dwr.util.getValue("datetype"); //var format = dwr.util.getValue("formats"); //var filterForData = document.getElementById("filterForData").checked; //var filterForData = true; var placeString = ""; //Simple ON if (simpleWord != "") { var simpleOn = true; } //Keyword ON if (keyAttribute != "" && keyTerm != "") { var keywordOn = true; } //Keyword2 ON if (keyAttribute2 != "" && keyTerm2 != "") { var keywordOn2 = true; } //Keyword3 ON if (keyAttribute3 != "" && keyTerm3 != "") { var keywordOn3 = true; } //SpatialON if (spatialString != "" || spatialSelect != "Select from list") { var spatialOn = true; } else { var spatialOn = false; } if(placeString != "") { var placeOn = true; } //Temporal ON if ((temporalStart != "" && temporalEnd != "") && temporalPeriod == "during" || (temporalPeriod != "during" && (temporalStart != "" && temporalEnd == "N/A"))) { temporalOn = true; } if ((temporalStart != "" && temporalEnd == "N/A") && temporalPeriod == "during") { alert("Please select enddate or the date range will be ignored"); } //Source ON if (sources != "") { var sourceOn = true; } // lter ON // if (document.sourceValues.sources[36].selected && (document.sourceValues.sources.selected == "LTER")){ // var lterSource = true; // alert("lter"); // } //Format ON // if(format != ""){ // var formatOn = true; // } //Actual Query if (simpleOn) { queryString += " Entire Document : " + simpleWord + " "; } if (simpleOn && keywordOn) { queryString += " and "; } if (keywordOn && !simpleOn) { queryString += keyAttribute + " = " + keyTerm + " "; } if (simpleOn && keywordOn) { queryString += keyAttribute + " = " + keyTerm + " "; } if(keywordOn2) { queryString += keyOP + " " +keyAttribute2 + " = " + keyTerm2 + " "; } if(keywordOn3) { queryString += keyOP2 + " " +keyAttribute3 + " = " + keyTerm3 + " "; } if ((simpleOn || keywordOn) && spatialOn) { queryString += " and "; } if (spatialOn) { queryString += spatialSearch + " coordinates (N,W,S,E) = " + "(" + spatialString + ")"; } if ((simpleOn || keywordOn || keywordOn2 || keywordOn3 || spatialOn) && placeOn) { queryString += " and "; } if(placeOn) { queryString += "place key: " + placeString; } if ((simpleOn || keywordOn || keywordOn2 || keywordOn3 || spatialOn || placeOn) && temporalOn) { queryString += " and "; } if (temporalOn) { queryString += dateType + ": " + temporalPeriod + " " + temporalStart + " to " + temporalEnd; } if (simpleOn || keywordOn || keywordOn2 || keywordOn3 || spatialOn || temporalOn || placeOn) { queryString += " and "; } // if (formatOn && (simpleOn || keywordOn || keywordOn2 || keywordOn3 || temporalOn || spatialOn || placeOn) && document.formatNames.formats[0].selected) { // queryString += "Format: "; // queryString += "All"; // } // else if(formatOn && (simpleOn || keywordOn || keywordOn2 || keywordOn3 || temporalOn || spatialOn || placeOn)){ // queryString += "Format: "; // queryString += format; // } if (simpleOn || keywordOn || keywordOn2 || keywordOn3 || spatialOn || temporalOn || placeOn) { queryString += " and "; } //alert(document.sourceValues.sources.value ) // if (sourceOn && (simpleOn || keywordOn || temporalOn || spatialOn || placeOn) && document.sourceValues.sources[0].selected) { // queryString += "from sources: "; // queryString += "All"; // } var oSelect=document.sourceValues.sources; if(sourceOn && (simpleOn || keywordOn || keywordOn2 || keywordOn3 || temporalOn || spatialOn || placeOn)){ queryString += "from sources: "; checkForAll = document.sourceValues.sources.value; if(checkForAll != "All"){ queryString += sources; } else if(checkForAll == "All" && sources.length == 1){ queryString += sources; } else if(checkForAll == "All" && sources.length > 1){ queryString += sources; queryString = queryString.replace('All,',''); oSelect.options[0].selected = false; } } // if (filterForData === true) { // queryString += " and filter for data on."; // } else { // queryString += " and filter for data off."; // } var completeQuery = dwr.util.setValue("query", queryString); } function doClearQ() { dwr.util.setValue("simpleWord", ""); dwr.util.setValue("searchThis", ""); dwr.util.setValue("searchThis2", ""); dwr.util.setValue("searchThis3", ""); dwr.util.setValue("keywordText", "FullText"); dwr.util.setValue("keywordText2", "FullText"); dwr.util.setValue("keywordText3", "FullText"); dwr.util.setValue("keywordText", "Select from list"); dwr.util.setValue("startDate", ""); dwr.util.setValue("endDate", ""); dwr.util.setValue("complete", ""); dwr.util.setValue("north", ""); dwr.util.setValue("west", ""); dwr.util.setValue("east", ""); dwr.util.setValue("south", ""); dwr.util.setValue("query", ""); dwr.util.setValue("placeList", "Select from list"); dwr.util.setValue("placeKey",""); //map.setCenter(new GLatLng(35.0,-14),1); //map.clearOverlays(); dwr.util.setValue("placeList", "Select from list"); dwr.util.setValue("sources", "All"); // dwr.util.setValue("formats", "All"); } function keywordClear() { dwr.util.setValue("keywordText", "FullText"); dwr.util.setValue("keywordText2", "FullText"); dwr.util.setValue("keywordText3", "FullText"); dwr.util.setValue("searchThis", ""); dwr.util.setValue("searchThis2", ""); dwr.util.setValue("searchThis3", ""); query(); } function spatialClear() { dwr.util.setValue("placeList", "Select from list"); dwr.util.setValue("north", ""); dwr.util.setValue("west", ""); dwr.util.setValue("east", ""); dwr.util.setValue("south", ""); dwr.util.setValue("complete", ""); dwr.util.setValue("placeKey",""); //map.setCenter(new GLatLng(35.0,-14),1); if(bMapPanel) clearPPoly(); else clearWPoly(); query(); } function temporalClear() { dwr.util.setValue("dateTest", "during"); dwr.util.setValue("startDate", ""); dwr.util.setValue("endDate", ""); dwr.util.setValue("datetype","either"); query(); } function clearTempDate() { var temporalPeriod = document.getElementById("dateTest").value; var temporalEnd = dwr.util.getValue("endDate"); if (temporalPeriod == "before" || temporalPeriod == "after") { dwr.util.setValue("endDate", "N/A"); } if (temporalPeriod == "during" && temporalEnd == "N/A") { dwr.util.setValue("endDate", ""); } query(); }