diff --git a/htroot/IndexFederated_p.html b/htroot/IndexFederated_p.html
index 3baaea700..778944774 100644
--- a/htroot/IndexFederated_p.html
+++ b/htroot/IndexFederated_p.html
@@ -64,6 +64,10 @@
Solr URL(s)
#[solr.indexing.url]#
You can set one or more Solr targets here which are accessed as a shard. For several targets, list them using a ',' (comma) as separator.
+
Sharding Method
diff --git a/htroot/portalsearch/portalsearch-dev.js b/htroot/portalsearch/portalsearch-dev.js
deleted file mode 100644
index d5ff27736..000000000
--- a/htroot/portalsearch/portalsearch-dev.js
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * YaCy Portalsearch
- *
- * @author Stefan Förster (apfelmaennchen)
- * @version 1.2
- *
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- *
- * Date: 10-Nov-2011
- *
- */
-
-function statuscheck() {
- if(load_status < 5) {
- return;
- } else {
- window.clearInterval(loading);
- yrun();
- }
-}
-
-$(document).ready(function() {
- ynavigators = new Array();
- $.ajaxSetup({
- timeout: 5000,
- cache: true
- })
- // apply default properties
- ycurr = '';
- startRecord = 0;
- maximumRecords = 10;
- submit = false;
- yconf = $.extend({
- url : '',
- 'global' : false,
- theme : 'start',
- title : 'YaCy Search Widget',
- logo : yconf.url + '/yacy/ui/img/yacy-logo.png',
- link : 'http://yacy.net',
- width : 640,
- height : 640,
- position : [150,50],
- modal : false,
- resizable: true,
- show : '',
- hide : '',
- load_js : true,
- load_css : true
- }, yconf);
-
- $('').appendTo("#yacylivesearch");
-
- if(yconf.load_css) {
- var style1 = yconf.url + '/portalsearch/yacy-portalsearch.css';
- var style2 = yconf.url + '/jquery/themes/'+yconf.theme+'/jquery-ui-1.8.16.custom.css';
- var style3 = yconf.url + '/jquery/css/jquery-ui-combobox.css';
-
- var head = document.getElementsByTagName('head')[0];
-
- $(document.createElement('link'))
- .attr({type:'text/css', href: style1, rel:'stylesheet', media:'screen'})
- .appendTo(head);
- $(document.createElement('link'))
- .attr({type:'text/css', href: style2, rel:'stylesheet', media:'screen'})
- .appendTo(head);
- $(document.createElement('link'))
- .attr({type:'text/css', href: style3, rel:'stylesheet', media:'screen'})
- .appendTo(head);
- }
-
- load_status = 0;
- loading = window.setInterval("statuscheck()", 200);
- if(yconf.load_js) {
- var script1 = yconf.url + '/jquery/js/jquery.query-2.1.7.js';
- var script2 = yconf.url + '/jquery/js/jquery.form-2.73.js';
- var script3 = yconf.url + '/jquery/js/jquery.field-0.9.2.min.js';
- var script4 = yconf.url + '/jquery/js/jquery-ui-1.8.16.custom.min.js';
- var script5 = yconf.url + '/jquery/js/jquery-ui-combobox.js';
-
- $.getScript(script1, function(){ load_status++; });
- $.getScript(script2, function(){ load_status++; });
- $.getScript(script3, function(){ load_status++; });
- $.getScript(script4, function(){ load_status++; });
- $.getScript(script5, function(){ load_status++; });
- } else {
- yrun();
- }
-});
-
-function yrun() {
- maximumRecords = parseInt($("#ysearch input[name='maximumRecords']").getValue());
- global = yconf.global;
-
- $("#ypopup").dialog({
- autoOpen: false,
- height: yconf.height,
- width: yconf.width,
- minWidth: yconf.width,
- position: yconf.position,
- modal: yconf.modal,
- resizable: yconf.resizable,
- title: yconf.title,
- show: yconf.show,
- hide: yconf.hide,
- drag: function(event, ui) {
- var position = $("#ypopup").parent(".ui-dialog").position();
- var left = $("#ypopup").parent(".ui-dialog").width()+5+position.left;
- $("#yside").dialog('option', 'position', [left,position.top+32]);
- },
- dragStop: function(event, ui) {
- var position = $("#ypopup").parent(".ui-dialog").position();
- var left = $("#ypopup").parent(".ui-dialog").width()+5+position.left;
- $("#yside").dialog('option', 'position', [left,position.top+32]);
- },
- resizeStop: function(event, ui) {
- var position = $("#ypopup").parent(".ui-dialog").position();
- var height = $("#ypopup").parent(".ui-dialog").height()-55;
- var left = $("#ypopup").parent(".ui-dialog").width()+5+position.left;
- $("#yside").dialog('option', 'height', height);
- $("#yside").dialog('option', 'position', [left,position.top+32]);
- },
- close: function(event, ui) {
- $("#yquery").setValue('');
- $("#yside").dialog('destroy');
- $('#yside').remove();
- },
- open: function(event, ui) {
- $('
').insertAfter("#ypopup").parent(".ui-dialog-content");
- var position = $("#ypopup").parent(".ui-dialog").position();
- $("#yside").dialog({
- title: 'Navigation',
- autoOpen: false,
- draggable: false,
- resizable: false,
- width: 220,
- height: $("#ypopup").parent(".ui-dialog").height()-55,
- minHeight: $("#ypopup").parent(".ui-dialog").height()-55,
- show: 'slide',
- hide: 'slide',
- position : [position.left+$("#ypopup").parent(".ui-dialog").width()+5,position.top+32],
- open: function(event, ui) {
- $('div.ui-widget-shadow').remove();
- $('#ypopup').dialog( 'moveToTop' );
- }
- });
- $('.ui-widget-shadow').remove();
- $('div[aria-labelledby="ui-dialog-title-yside"] div.ui-dialog-titlebar').remove();
-
- $("#ypopup").bind("scroll", function(e){
- p1 = $("#ypopup h3 :last").position().top;
- if(p1-$("#ypopup").dialog( "option", "height" ) < 0) {
- startRecord = startRecord + maximumRecords;
- yacysearch(false);
- }
- });
-
-
- }
- });
-
- $('#ysearch').keyup(function(e) { // React to keyboard input
-
- if(e.which == 27) { // Close popup on ESC
- $("#ypopup").dialog('close');
- $("#yquery").setValue("");
- }
-
- if(e.which == 18) { // Global search on ALT
- global = true;
- ycurr = $("#yquery").getValue();
- yacysearch(true);
- }
-
- if(ycurr == $("#yquery").getValue()) { // Do nothing if search term hasn't changed
- return false;
- }
-
- global = yconf.global; // As this is a new search, revert to default resource
-
- if ($("#yquery").getValue() == '') { // If search term is empty reset to default resource and close popup
- if($("#ypopup").dialog('isOpen'))
- $("#ypopup").dialog('close');
- } else { // Else fire up a search request and remeber the current search term
- ycurr = $("#yquery").getValue();
- yacysearch(true);
- }
- return false;
- });
-
- $('#ysearch').submit(function() { // Submit a search request
- ycurr = $("#yquery").getValue();
-
- if (!$("#ypopup").dialog('isOpen'))
- $("#ypopup").dialog('open');
- else
- if ($("#yside").dialog('isOpen'))
- $("#yside").dialog('close');
-
- $("#yquery").focus();
-
- yacysearch(true);
- return false;
- });
-}
-
-function yacysearch(clear) {
- var url = yconf.url + '/yacysearch.json?callback=?' // JSONP (cross domain) request URL
-
- if(clear) {
- $('#ypopup').empty();
- var loading = "Loading: "+yconf.url+" ";
- var loadimg = " ";
- $('#ypopup').append(loading+loadimg);
-
- if (!$("#ypopup").dialog('isOpen'))
- $("#ypopup").dialog('open');
- else
- if ($("#yside").dialog('isOpen'))
- $("#yside").dialog('close');
-
- $("#yquery").focus();
- }
-
- var param = []; // Generate search request parameters from HTML form
- $("#ysearch input").each(function(i){
- var item = { name : $(this).attr('name'), value : $(this).attr('value') };
- if(item.name == 'resource') { // Set parameter for resource according to global
- if(global)
- item.value = 'global';
- else {
- item.value = 'local'
- }
- }
- if(item.name == 'query' || item.name == 'search') {
- item.value = $.trim(item.value); // remove heading and trailing white spaces from querey
- if(item.value != ycurr) // in case of fast typing ycurr needs to be updated
- ycurr = item.value;
- }
- param[i] = item;
- });
- param[param.length] = { name : 'startRecord', value : startRecord };
-
- $.ajaxSetup({
- timeout: 10000,
- error: function(x,e) {
- var err = 'Unknow Error: '+x.responseText;
- if(x.status==0) {
- err = 'Unknown Network Error! I try to reload...';
- yacysearch(true);
- } else if(x.status==404) {
- err = x.status + ' - Requested URL not found.';
- } else if(x.status==500) {
- err = x.status + ' - Internel Server Error.';
- } else if(e=='parsererror') {
- err = 'Parsing JSON Request failed.';
- } else if(e=='timeout') {
- err = 'Request Time out.';
- };
- if (clear) $('#ypopup').empty();
- var favicon = " ";
- var title = ""+favicon+" "+err+" ";
- var url = "Current search terms: "+ycurr+"
"
- $(title+url).appendTo("#ypopup");
- }
- });
-
- $.getJSON(url, param,
- function(json, status) {
-
- if (json[0]) data = json[0];
- else data = json;
-
- var searchTerms = "";
- searchTerms = data.channels[0].searchTerms;
-
- if($.trim(ycurr.replace(/ /g,"+")) != searchTerms) {
- return false;
- }
- if(clear) {
- $('#ypopup').empty();
- }
-
- var total = data.channels[0].totalResults;
-
- if(global) var result = 'global';
- else var result = 'local';
-
- var count = 0;
- $.each (
- data.channels[0].items,
- function(i,item) {
- if (item) {
- var favicon = " ";
- var title = "";
- var url = ""+item.link+"
"
- var desc = ""+item.description+"
";
- var date = ""+item.pubDate.substring(0,16);
- var size = " | "+item.sizename+"
";
- $(title+desc+url+date+size).appendTo("#ypopup");
- }
- count++;
- }
- );
-
- if(count == 0) {
- if (clear) $('#ypopup').empty();
- var favicon = " ";
- var title = ""+favicon+"No search results! ";
- var url = "Current search terms: "+searchTerms+"
"
- var desc = "You could restate your search, release some navigators or switch to global search...
";
- $(title+desc+url).appendTo("#ypopup");
- }
-
- if(clear) {
- $('#yside').empty();
-
- var ylogo = " ";
- var ymsg= "Total "+result+" results: "+total;
- $(""+ylogo+" "+ymsg+" ').appendTo("#yside");
-
- var selected = 'selected="selected">';
- var select1 = '' + select2 + selected + select3;
- } else {
- select = select1 + selected + select2 + '>' + select3;
- }
-
- $('Get local/global results: '+select+'
').appendTo('#yside');
- $("#yglobal").combobox({
- selected: function(event, ui) {
- if(ui.item.value == "global") {
- global = true;
- } else {
- global = false;
- }
- yacysearch(true);
- }
- });
-
- select1 = '' + select2 + selected + select3;
- } else {
- select = select1 + selected + select2 + '>' + select3;
- }
- $('Sort result by: '+select+'
').appendTo('#yside');
- $("#yrecent").combobox({
- selected: function(event, ui) {
- if(ui.item.value == "date") {
- query = query + " /date";
- } else {
- query = query.replace(/\s\/date/g,"");
- }
- $("#yquery").setValue($.trim(query));
- $("#yquery").trigger('keyup');
- }
- });
-
- $(' ').appendTo("#yside");
- $("You can narrow down your search by selecting one of the below navigators:
").appendTo('#yside');
-
- /*
- var label = 'Language: ';
- var select = 'Select one... en-English fr-French es-Spanish de-German zh-Chinese ';
- $(''+label+select+'
').appendTo('#yside');
- $("#ylang").combobox({
- selected: function(event, ui) {
- var query = unescape($("#yquery").getValue() + " /language/" +ui.item.value);
- $("#yquery").setValue(query);
- ynavigators.push("/language/"+ui.item.value);
- $("#yquery").trigger('keyup');
- }
- });
- */
-
- $.each ( // Loop through all available navigators and include comboboxes in sidebar
- data.channels[0].navigation,
- function(i,facet) {
- if (facet) {
- var id = "#y"+facet.facetname;
- var label = '' +facet.displayname+ ': ';
- var select = 'Select one... ';
- $(''+label+select+'
').appendTo('#yside');
- $.each (
- facet.elements,
- function(j,element) {
- var mod = ' '+element.name+ ' (' +element.count+ ') ';
- $(mod).appendTo(id);
- }
- )
- $(id).combobox({
- selected: function(event, ui) {
- var query = unescape($("#yquery").getValue() + " " +ui.item.value);
- $("#yquery").setValue(query);
- ynavigators.push(ui.item.value);
- $("#yquery").trigger('submit');
- }
- });
- }
- }
- );
-
- $(' ').appendTo("#yside");
- if(ynavigators.length > 0) {
- $("Uncheck to release navigators:
").appendTo('#yside');
- }
-
- cancelNavigators(ynavigators, "#yside");
-
- if($("#ypopup .yloading").length == 0) {
- $(".ynav-cancel").bind("change", function(event) {
- var query = $("#yquery").getValue();
- var str = $(event.target).val();
- var idx = ynavigators.indexOf($.trim(str));
- if(idx!=-1) ynavigators.splice(idx, 1);
- var regexp = new RegExp(' '+str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")); // properly escape string for regexp
- $("#yquery").setValue($.trim(query.replace(regexp,"")));
- startRecord = 0;
- $("#yquery").trigger('submit');
- });
- autoOpenSidebar();
- if ($("#ypopup").dialog('isOpen')) {
- // If you got maximumRecords results, but still have display space, load more results
- if($("#ypopup h3 :last").position().top < $("#ypopup").dialog( "option", "height" ) && count == maximumRecords) {
- startRecord = startRecord + maximumRecords;
- yacysearch(false);
- }
- }
- }
- }
- }
- );
- function autoOpenSidebar() {
- window.setTimeout(function() { // The delay prevents the sidebar to open on every intermediate search results
- if($("#ypopup .yloading").length == 0) { // Check again wether a search result is still loading
- if( $("#yquery").getValue() == ycurr) { // Open side bar only if result matches current search term
- $("#yside").dialog('open');
- $("#yquery").focus();
- }
- }
- } , 1000);
- }
- function cancelNavigators(ynavigators, appendTo) { // Include checkboxes to release navigators
- var arLen=ynavigators.length;
- var query = $("#yquery").getValue();
- for ( var i=0, len=arLen; i'+ynavigators[i]+' ').appendTo(appendTo);
- else
- ynavigators.splice(i, 1); // Remove navigator from array as it has been removed manually from search term
- }
- }
-}
\ No newline at end of file
diff --git a/htroot/portalsearch/yacy-portalsearch.js b/htroot/portalsearch/yacy-portalsearch.js
index cc6788f3c..d5ff27736 100644
--- a/htroot/portalsearch/yacy-portalsearch.js
+++ b/htroot/portalsearch/yacy-portalsearch.js
@@ -1 +1,464 @@
-function yacysearch(a){function g(a,b){var c=a.length;var d=$("#yquery").getValue();for(var e=0,f=c;e'+a[e]+" ").appendTo(b);else a.splice(e,1)}}function f(){window.setTimeout(function(){if($("#ypopup .yloading").length==0){if($("#yquery").getValue()==ycurr){$("#yside").dialog("open");$("#yquery").focus()}}},1e3)}var b=yconf.url+"/yacysearch.json?callback=?";if(a){$("#ypopup").empty();var c="Loading: "+yconf.url+" ";var d=" ";$("#ypopup").append(c+d);if(!$("#ypopup").dialog("isOpen"))$("#ypopup").dialog("open");else if($("#yside").dialog("isOpen"))$("#yside").dialog("close");$("#yquery").focus()}var e=[];$("#ysearch input").each(function(a){var b={name:$(this).attr("name"),value:$(this).attr("value")};if(b.name=="resource"){if(global)b.value="global";else{b.value="local"}}if(b.name=="query"||b.name=="search"){b.value=$.trim(b.value);if(b.value!=ycurr)ycurr=b.value}e[a]=b});e[e.length]={name:"startRecord",value:startRecord};$.ajaxSetup({timeout:1e4,error:function(b,c){var d="Unknow Error: "+b.responseText;if(b.status==0){d="Unknown Network Error! I try to reload...";yacysearch(true)}else if(b.status==404){d=b.status+" - Requested URL not found."}else if(b.status==500){d=b.status+" - Internel Server Error."}else if(c=="parsererror"){d="Parsing JSON Request failed."}else if(c=="timeout"){d="Request Time out."}if(a)$("#ypopup").empty();var e=" ";var f=""+e+" "+d+" ";var g="Current search terms: "+ycurr+"
";$(f+g).appendTo("#ypopup")}});$.getJSON(b,e,function(b,c){if(b[0])data=b[0];else data=b;var d="";d=data.channels[0].searchTerms;if($.trim(ycurr.replace(/ /g,"+"))!=d){return false}if(a){$("#ypopup").empty()}var e=data.channels[0].totalResults;if(global)var h="global";else var h="local";var i=0;$.each(data.channels[0].items,function(a,b){if(b){var c=" ";var d="";var e=""+b.link+"
";var f=""+b.description+"
";var g=""+b.pubDate.substring(0,16);var h=" | "+b.sizename+"
";$(d+f+e+g+h).appendTo("#ypopup")}i++});if(i==0){if(a)$("#ypopup").empty();var j=" ";var k=""+j+"No search results! ";var l="Current search terms: "+d+"
";var m="You could restate your search, release some navigators or switch to global search...
";$(k+m+l).appendTo("#ypopup")}if(a){$("#yside").empty();var n=" ";var o="Total "+h+" results: "+e;$(""+n+" "+o+" ").appendTo("#yside");var p='selected="selected">';var q='"+r+p+s}else{select=q+p+r+">"+s}$('Get local/global results: '+select+"
").appendTo("#yside");$("#yglobal").combobox({selected:function(a,b){if(b.item.value=="global"){global=true}else{global=false}yacysearch(true)}});q=' ";var t=unescape($("#yquery").getValue());if(t.indexOf("/date")!=-1){select=q+">"+r+p+s}else{select=q+p+r+">"+s}$('Sort result by: '+select+"
").appendTo("#yside");$("#yrecent").combobox({selected:function(a,b){if(b.item.value=="date"){t=t+" /date"}else{t=t.replace(/\s\/date/g,"")}$("#yquery").setValue($.trim(t));$("#yquery").trigger("keyup")}});$(" ").appendTo("#yside");$("You can narrow down your search by selecting one of the below navigators:
").appendTo("#yside");$.each(data.channels[0].navigation,function(a,b){if(b){var c="#y"+b.facetname;var d=''+b.displayname+": ";var e='Select one... ';$(''+d+e+"
").appendTo("#yside");$.each(b.elements,function(a,b){var d=' '+b.name+" ("+b.count+") ";$(d).appendTo(c)});$(c).combobox({selected:function(a,b){var c=unescape($("#yquery").getValue()+" "+b.item.value);$("#yquery").setValue(c);ynavigators.push(b.item.value);$("#yquery").trigger("submit")}})}});$(" ").appendTo("#yside");if(ynavigators.length>0){$("Uncheck to release navigators:
").appendTo("#yside")}g(ynavigators,"#yside");if($("#ypopup .yloading").length==0){$(".ynav-cancel").bind("change",function(a){var b=$("#yquery").getValue();var c=$(a.target).val();var d=ynavigators.indexOf($.trim(c));if(d!=-1)ynavigators.splice(d,1);var e=new RegExp(" "+c.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"));$("#yquery").setValue($.trim(b.replace(e,"")));startRecord=0;$("#yquery").trigger("submit")});f();if($("#ypopup").dialog("isOpen")){if($("#ypopup h3 :last").position().top<$("#ypopup").dialog("option","height")&&i==maximumRecords){startRecord=startRecord+maximumRecords;yacysearch(false)}}}}})}function yrun(){maximumRecords=parseInt($("#ysearch input[name='maximumRecords']").getValue());global=yconf.global;$("#ypopup").dialog({autoOpen:false,height:yconf.height,width:yconf.width,minWidth:yconf.width,position:yconf.position,modal:yconf.modal,resizable:yconf.resizable,title:yconf.title,show:yconf.show,hide:yconf.hide,drag:function(a,b){var c=$("#ypopup").parent(".ui-dialog").position();var d=$("#ypopup").parent(".ui-dialog").width()+5+c.left;$("#yside").dialog("option","position",[d,c.top+32])},dragStop:function(a,b){var c=$("#ypopup").parent(".ui-dialog").position();var d=$("#ypopup").parent(".ui-dialog").width()+5+c.left;$("#yside").dialog("option","position",[d,c.top+32])},resizeStop:function(a,b){var c=$("#ypopup").parent(".ui-dialog").position();var d=$("#ypopup").parent(".ui-dialog").height()-55;var e=$("#ypopup").parent(".ui-dialog").width()+5+c.left;$("#yside").dialog("option","height",d);$("#yside").dialog("option","position",[e,c.top+32])},close:function(a,b){$("#yquery").setValue("");$("#yside").dialog("destroy");$("#yside").remove()},open:function(a,b){$('
').insertAfter("#ypopup").parent(".ui-dialog-content");var c=$("#ypopup").parent(".ui-dialog").position();$("#yside").dialog({title:"Navigation",autoOpen:false,draggable:false,resizable:false,width:220,height:$("#ypopup").parent(".ui-dialog").height()-55,minHeight:$("#ypopup").parent(".ui-dialog").height()-55,show:"slide",hide:"slide",position:[c.left+$("#ypopup").parent(".ui-dialog").width()+5,c.top+32],open:function(a,b){$("div.ui-widget-shadow").remove();$("#ypopup").dialog("moveToTop")}});$(".ui-widget-shadow").remove();$('div[aria-labelledby="ui-dialog-title-yside"] div.ui-dialog-titlebar').remove();$("#ypopup").bind("scroll",function(a){p1=$("#ypopup h3 :last").position().top;if(p1-$("#ypopup").dialog("option","height")<0){startRecord=startRecord+maximumRecords;yacysearch(false)}})}});$("#ysearch").keyup(function(a){if(a.which==27){$("#ypopup").dialog("close");$("#yquery").setValue("")}if(a.which==18){global=true;ycurr=$("#yquery").getValue();yacysearch(true)}if(ycurr==$("#yquery").getValue()){return false}global=yconf.global;if($("#yquery").getValue()==""){if($("#ypopup").dialog("isOpen"))$("#ypopup").dialog("close")}else{ycurr=$("#yquery").getValue();yacysearch(true)}return false});$("#ysearch").submit(function(){ycurr=$("#yquery").getValue();if(!$("#ypopup").dialog("isOpen"))$("#ypopup").dialog("open");else if($("#yside").dialog("isOpen"))$("#yside").dialog("close");$("#yquery").focus();yacysearch(true);return false})}function statuscheck(){if(load_status<5){return}else{window.clearInterval(loading);yrun()}}$(document).ready(function(){ynavigators=new Array;$.ajaxSetup({timeout:5e3,cache:true});ycurr="";startRecord=0;maximumRecords=10;submit=false;yconf=$.extend({url:"",global:false,theme:"start",title:"YaCy Search Widget",logo:yconf.url+"/yacy/ui/img/yacy-logo.png",link:"http://yacy.net",width:640,height:640,position:[150,50],modal:false,resizable:true,show:"",hide:"",load_js:true,load_css:true},yconf);$('').appendTo("#yacylivesearch");if(yconf.load_css){var a=yconf.url+"/portalsearch/yacy-portalsearch.css";var b=yconf.url+"/jquery/themes/"+yconf.theme+"/jquery-ui-1.8.16.custom.css";var c=yconf.url+"/jquery/css/jquery-ui-combobox.css";var d=document.getElementsByTagName("head")[0];$(document.createElement("link")).attr({type:"text/css",href:a,rel:"stylesheet",media:"screen"}).appendTo(d);$(document.createElement("link")).attr({type:"text/css",href:b,rel:"stylesheet",media:"screen"}).appendTo(d);$(document.createElement("link")).attr({type:"text/css",href:c,rel:"stylesheet",media:"screen"}).appendTo(d)}load_status=0;loading=window.setInterval("statuscheck()",200);if(yconf.load_js){var e=yconf.url+"/jquery/js/jquery.query-2.1.7.js";var f=yconf.url+"/jquery/js/jquery.form-2.73.js";var g=yconf.url+"/jquery/js/jquery.field-0.9.2.min.js";var h=yconf.url+"/jquery/js/jquery-ui-1.8.16.custom.min.js";var i=yconf.url+"/jquery/js/jquery-ui-combobox.js";$.getScript(e,function(){load_status++});$.getScript(f,function(){load_status++});$.getScript(g,function(){load_status++});$.getScript(h,function(){load_status++});$.getScript(i,function(){load_status++})}else{yrun()}})
\ No newline at end of file
+/*
+ * YaCy Portalsearch
+ *
+ * @author Stefan Förster (apfelmaennchen)
+ * @version 1.2
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ * Date: 10-Nov-2011
+ *
+ */
+
+function statuscheck() {
+ if(load_status < 5) {
+ return;
+ } else {
+ window.clearInterval(loading);
+ yrun();
+ }
+}
+
+$(document).ready(function() {
+ ynavigators = new Array();
+ $.ajaxSetup({
+ timeout: 5000,
+ cache: true
+ })
+ // apply default properties
+ ycurr = '';
+ startRecord = 0;
+ maximumRecords = 10;
+ submit = false;
+ yconf = $.extend({
+ url : '',
+ 'global' : false,
+ theme : 'start',
+ title : 'YaCy Search Widget',
+ logo : yconf.url + '/yacy/ui/img/yacy-logo.png',
+ link : 'http://yacy.net',
+ width : 640,
+ height : 640,
+ position : [150,50],
+ modal : false,
+ resizable: true,
+ show : '',
+ hide : '',
+ load_js : true,
+ load_css : true
+ }, yconf);
+
+ $('').appendTo("#yacylivesearch");
+
+ if(yconf.load_css) {
+ var style1 = yconf.url + '/portalsearch/yacy-portalsearch.css';
+ var style2 = yconf.url + '/jquery/themes/'+yconf.theme+'/jquery-ui-1.8.16.custom.css';
+ var style3 = yconf.url + '/jquery/css/jquery-ui-combobox.css';
+
+ var head = document.getElementsByTagName('head')[0];
+
+ $(document.createElement('link'))
+ .attr({type:'text/css', href: style1, rel:'stylesheet', media:'screen'})
+ .appendTo(head);
+ $(document.createElement('link'))
+ .attr({type:'text/css', href: style2, rel:'stylesheet', media:'screen'})
+ .appendTo(head);
+ $(document.createElement('link'))
+ .attr({type:'text/css', href: style3, rel:'stylesheet', media:'screen'})
+ .appendTo(head);
+ }
+
+ load_status = 0;
+ loading = window.setInterval("statuscheck()", 200);
+ if(yconf.load_js) {
+ var script1 = yconf.url + '/jquery/js/jquery.query-2.1.7.js';
+ var script2 = yconf.url + '/jquery/js/jquery.form-2.73.js';
+ var script3 = yconf.url + '/jquery/js/jquery.field-0.9.2.min.js';
+ var script4 = yconf.url + '/jquery/js/jquery-ui-1.8.16.custom.min.js';
+ var script5 = yconf.url + '/jquery/js/jquery-ui-combobox.js';
+
+ $.getScript(script1, function(){ load_status++; });
+ $.getScript(script2, function(){ load_status++; });
+ $.getScript(script3, function(){ load_status++; });
+ $.getScript(script4, function(){ load_status++; });
+ $.getScript(script5, function(){ load_status++; });
+ } else {
+ yrun();
+ }
+});
+
+function yrun() {
+ maximumRecords = parseInt($("#ysearch input[name='maximumRecords']").getValue());
+ global = yconf.global;
+
+ $("#ypopup").dialog({
+ autoOpen: false,
+ height: yconf.height,
+ width: yconf.width,
+ minWidth: yconf.width,
+ position: yconf.position,
+ modal: yconf.modal,
+ resizable: yconf.resizable,
+ title: yconf.title,
+ show: yconf.show,
+ hide: yconf.hide,
+ drag: function(event, ui) {
+ var position = $("#ypopup").parent(".ui-dialog").position();
+ var left = $("#ypopup").parent(".ui-dialog").width()+5+position.left;
+ $("#yside").dialog('option', 'position', [left,position.top+32]);
+ },
+ dragStop: function(event, ui) {
+ var position = $("#ypopup").parent(".ui-dialog").position();
+ var left = $("#ypopup").parent(".ui-dialog").width()+5+position.left;
+ $("#yside").dialog('option', 'position', [left,position.top+32]);
+ },
+ resizeStop: function(event, ui) {
+ var position = $("#ypopup").parent(".ui-dialog").position();
+ var height = $("#ypopup").parent(".ui-dialog").height()-55;
+ var left = $("#ypopup").parent(".ui-dialog").width()+5+position.left;
+ $("#yside").dialog('option', 'height', height);
+ $("#yside").dialog('option', 'position', [left,position.top+32]);
+ },
+ close: function(event, ui) {
+ $("#yquery").setValue('');
+ $("#yside").dialog('destroy');
+ $('#yside').remove();
+ },
+ open: function(event, ui) {
+ $('
').insertAfter("#ypopup").parent(".ui-dialog-content");
+ var position = $("#ypopup").parent(".ui-dialog").position();
+ $("#yside").dialog({
+ title: 'Navigation',
+ autoOpen: false,
+ draggable: false,
+ resizable: false,
+ width: 220,
+ height: $("#ypopup").parent(".ui-dialog").height()-55,
+ minHeight: $("#ypopup").parent(".ui-dialog").height()-55,
+ show: 'slide',
+ hide: 'slide',
+ position : [position.left+$("#ypopup").parent(".ui-dialog").width()+5,position.top+32],
+ open: function(event, ui) {
+ $('div.ui-widget-shadow').remove();
+ $('#ypopup').dialog( 'moveToTop' );
+ }
+ });
+ $('.ui-widget-shadow').remove();
+ $('div[aria-labelledby="ui-dialog-title-yside"] div.ui-dialog-titlebar').remove();
+
+ $("#ypopup").bind("scroll", function(e){
+ p1 = $("#ypopup h3 :last").position().top;
+ if(p1-$("#ypopup").dialog( "option", "height" ) < 0) {
+ startRecord = startRecord + maximumRecords;
+ yacysearch(false);
+ }
+ });
+
+
+ }
+ });
+
+ $('#ysearch').keyup(function(e) { // React to keyboard input
+
+ if(e.which == 27) { // Close popup on ESC
+ $("#ypopup").dialog('close');
+ $("#yquery").setValue("");
+ }
+
+ if(e.which == 18) { // Global search on ALT
+ global = true;
+ ycurr = $("#yquery").getValue();
+ yacysearch(true);
+ }
+
+ if(ycurr == $("#yquery").getValue()) { // Do nothing if search term hasn't changed
+ return false;
+ }
+
+ global = yconf.global; // As this is a new search, revert to default resource
+
+ if ($("#yquery").getValue() == '') { // If search term is empty reset to default resource and close popup
+ if($("#ypopup").dialog('isOpen'))
+ $("#ypopup").dialog('close');
+ } else { // Else fire up a search request and remeber the current search term
+ ycurr = $("#yquery").getValue();
+ yacysearch(true);
+ }
+ return false;
+ });
+
+ $('#ysearch').submit(function() { // Submit a search request
+ ycurr = $("#yquery").getValue();
+
+ if (!$("#ypopup").dialog('isOpen'))
+ $("#ypopup").dialog('open');
+ else
+ if ($("#yside").dialog('isOpen'))
+ $("#yside").dialog('close');
+
+ $("#yquery").focus();
+
+ yacysearch(true);
+ return false;
+ });
+}
+
+function yacysearch(clear) {
+ var url = yconf.url + '/yacysearch.json?callback=?' // JSONP (cross domain) request URL
+
+ if(clear) {
+ $('#ypopup').empty();
+ var loading = "Loading: "+yconf.url+" ";
+ var loadimg = " ";
+ $('#ypopup').append(loading+loadimg);
+
+ if (!$("#ypopup").dialog('isOpen'))
+ $("#ypopup").dialog('open');
+ else
+ if ($("#yside").dialog('isOpen'))
+ $("#yside").dialog('close');
+
+ $("#yquery").focus();
+ }
+
+ var param = []; // Generate search request parameters from HTML form
+ $("#ysearch input").each(function(i){
+ var item = { name : $(this).attr('name'), value : $(this).attr('value') };
+ if(item.name == 'resource') { // Set parameter for resource according to global
+ if(global)
+ item.value = 'global';
+ else {
+ item.value = 'local'
+ }
+ }
+ if(item.name == 'query' || item.name == 'search') {
+ item.value = $.trim(item.value); // remove heading and trailing white spaces from querey
+ if(item.value != ycurr) // in case of fast typing ycurr needs to be updated
+ ycurr = item.value;
+ }
+ param[i] = item;
+ });
+ param[param.length] = { name : 'startRecord', value : startRecord };
+
+ $.ajaxSetup({
+ timeout: 10000,
+ error: function(x,e) {
+ var err = 'Unknow Error: '+x.responseText;
+ if(x.status==0) {
+ err = 'Unknown Network Error! I try to reload...';
+ yacysearch(true);
+ } else if(x.status==404) {
+ err = x.status + ' - Requested URL not found.';
+ } else if(x.status==500) {
+ err = x.status + ' - Internel Server Error.';
+ } else if(e=='parsererror') {
+ err = 'Parsing JSON Request failed.';
+ } else if(e=='timeout') {
+ err = 'Request Time out.';
+ };
+ if (clear) $('#ypopup').empty();
+ var favicon = " ";
+ var title = ""+favicon+" "+err+" ";
+ var url = "Current search terms: "+ycurr+"
"
+ $(title+url).appendTo("#ypopup");
+ }
+ });
+
+ $.getJSON(url, param,
+ function(json, status) {
+
+ if (json[0]) data = json[0];
+ else data = json;
+
+ var searchTerms = "";
+ searchTerms = data.channels[0].searchTerms;
+
+ if($.trim(ycurr.replace(/ /g,"+")) != searchTerms) {
+ return false;
+ }
+ if(clear) {
+ $('#ypopup').empty();
+ }
+
+ var total = data.channels[0].totalResults;
+
+ if(global) var result = 'global';
+ else var result = 'local';
+
+ var count = 0;
+ $.each (
+ data.channels[0].items,
+ function(i,item) {
+ if (item) {
+ var favicon = " ";
+ var title = "";
+ var url = ""+item.link+"
"
+ var desc = ""+item.description+"
";
+ var date = ""+item.pubDate.substring(0,16);
+ var size = " | "+item.sizename+"
";
+ $(title+desc+url+date+size).appendTo("#ypopup");
+ }
+ count++;
+ }
+ );
+
+ if(count == 0) {
+ if (clear) $('#ypopup').empty();
+ var favicon = " ";
+ var title = ""+favicon+"No search results! ";
+ var url = "Current search terms: "+searchTerms+"
"
+ var desc = "You could restate your search, release some navigators or switch to global search...
";
+ $(title+desc+url).appendTo("#ypopup");
+ }
+
+ if(clear) {
+ $('#yside').empty();
+
+ var ylogo = " ";
+ var ymsg= "Total "+result+" results: "+total;
+ $(""+ylogo+" "+ymsg+" ').appendTo("#yside");
+
+ var selected = 'selected="selected">';
+ var select1 = '' + select2 + selected + select3;
+ } else {
+ select = select1 + selected + select2 + '>' + select3;
+ }
+
+ $('Get local/global results: '+select+'
').appendTo('#yside');
+ $("#yglobal").combobox({
+ selected: function(event, ui) {
+ if(ui.item.value == "global") {
+ global = true;
+ } else {
+ global = false;
+ }
+ yacysearch(true);
+ }
+ });
+
+ select1 = '' + select2 + selected + select3;
+ } else {
+ select = select1 + selected + select2 + '>' + select3;
+ }
+ $('Sort result by: '+select+'
').appendTo('#yside');
+ $("#yrecent").combobox({
+ selected: function(event, ui) {
+ if(ui.item.value == "date") {
+ query = query + " /date";
+ } else {
+ query = query.replace(/\s\/date/g,"");
+ }
+ $("#yquery").setValue($.trim(query));
+ $("#yquery").trigger('keyup');
+ }
+ });
+
+ $(' ').appendTo("#yside");
+ $("You can narrow down your search by selecting one of the below navigators:
").appendTo('#yside');
+
+ /*
+ var label = 'Language: ';
+ var select = 'Select one... en-English fr-French es-Spanish de-German zh-Chinese ';
+ $(''+label+select+'
').appendTo('#yside');
+ $("#ylang").combobox({
+ selected: function(event, ui) {
+ var query = unescape($("#yquery").getValue() + " /language/" +ui.item.value);
+ $("#yquery").setValue(query);
+ ynavigators.push("/language/"+ui.item.value);
+ $("#yquery").trigger('keyup');
+ }
+ });
+ */
+
+ $.each ( // Loop through all available navigators and include comboboxes in sidebar
+ data.channels[0].navigation,
+ function(i,facet) {
+ if (facet) {
+ var id = "#y"+facet.facetname;
+ var label = '' +facet.displayname+ ': ';
+ var select = 'Select one... ';
+ $(''+label+select+'
').appendTo('#yside');
+ $.each (
+ facet.elements,
+ function(j,element) {
+ var mod = ' '+element.name+ ' (' +element.count+ ') ';
+ $(mod).appendTo(id);
+ }
+ )
+ $(id).combobox({
+ selected: function(event, ui) {
+ var query = unescape($("#yquery").getValue() + " " +ui.item.value);
+ $("#yquery").setValue(query);
+ ynavigators.push(ui.item.value);
+ $("#yquery").trigger('submit');
+ }
+ });
+ }
+ }
+ );
+
+ $(' ').appendTo("#yside");
+ if(ynavigators.length > 0) {
+ $("Uncheck to release navigators:
").appendTo('#yside');
+ }
+
+ cancelNavigators(ynavigators, "#yside");
+
+ if($("#ypopup .yloading").length == 0) {
+ $(".ynav-cancel").bind("change", function(event) {
+ var query = $("#yquery").getValue();
+ var str = $(event.target).val();
+ var idx = ynavigators.indexOf($.trim(str));
+ if(idx!=-1) ynavigators.splice(idx, 1);
+ var regexp = new RegExp(' '+str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")); // properly escape string for regexp
+ $("#yquery").setValue($.trim(query.replace(regexp,"")));
+ startRecord = 0;
+ $("#yquery").trigger('submit');
+ });
+ autoOpenSidebar();
+ if ($("#ypopup").dialog('isOpen')) {
+ // If you got maximumRecords results, but still have display space, load more results
+ if($("#ypopup h3 :last").position().top < $("#ypopup").dialog( "option", "height" ) && count == maximumRecords) {
+ startRecord = startRecord + maximumRecords;
+ yacysearch(false);
+ }
+ }
+ }
+ }
+ }
+ );
+ function autoOpenSidebar() {
+ window.setTimeout(function() { // The delay prevents the sidebar to open on every intermediate search results
+ if($("#ypopup .yloading").length == 0) { // Check again wether a search result is still loading
+ if( $("#yquery").getValue() == ycurr) { // Open side bar only if result matches current search term
+ $("#yside").dialog('open');
+ $("#yquery").focus();
+ }
+ }
+ } , 1000);
+ }
+ function cancelNavigators(ynavigators, appendTo) { // Include checkboxes to release navigators
+ var arLen=ynavigators.length;
+ var query = $("#yquery").getValue();
+ for ( var i=0, len=arLen; i'+ynavigators[i]+' ').appendTo(appendTo);
+ else
+ ynavigators.splice(i, 1); // Remove navigator from array as it has been removed manually from search term
+ }
+ }
+}
\ No newline at end of file
diff --git a/source/net/yacy/peers/Protocol.java b/source/net/yacy/peers/Protocol.java
index 8660091e9..2352c110b 100644
--- a/source/net/yacy/peers/Protocol.java
+++ b/source/net/yacy/peers/Protocol.java
@@ -1733,4 +1733,4 @@ public final class Protocol {
return parts;
}
-}
+}
diff --git a/source/net/yacy/search/schema/CollectionConfiguration.java b/source/net/yacy/search/schema/CollectionConfiguration.java
index 37860b6b0..d56ecd1c0 100644
--- a/source/net/yacy/search/schema/CollectionConfiguration.java
+++ b/source/net/yacy/search/schema/CollectionConfiguration.java
@@ -144,12 +144,14 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri
*/
public SolrInputDocument toSolrInputDocument(SolrDocument doc) {
SolrInputDocument sid = new SolrInputDocument();
- Set omitFields = new HashSet();
+ Set omitFields = new HashSet(3);
+ omitFields.add(CollectionSchema.author_sxt.getSolrFieldName());
omitFields.add(CollectionSchema.coordinate_p.getSolrFieldName() + "_0_coordinate");
omitFields.add(CollectionSchema.coordinate_p.getSolrFieldName() + "_1_coordinate");
- omitFields.add(CollectionSchema.author_sxt.getSolrFieldName());
for (String name: doc.getFieldNames()) {
- if (this.contains(name) && !omitFields.contains(name)) sid.addField(name, doc.getFieldValue(name), 1.0f);
+ if (this.contains(name) && !omitFields.contains(name)) { // check each field if enabled in local Solr schema
+ sid.addField(name, doc.getFieldValue(name), 1.0f);
+ }
}
return sid;
}
diff --git a/source/net/yacy/search/schema/WebgraphConfiguration.java b/source/net/yacy/search/schema/WebgraphConfiguration.java
index 573034785..8b3bdeadc 100644
--- a/source/net/yacy/search/schema/WebgraphConfiguration.java
+++ b/source/net/yacy/search/schema/WebgraphConfiguration.java
@@ -34,6 +34,7 @@ import java.util.Map;
import java.util.Properties;
import java.util.Set;
+import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrInputDocument;
import net.yacy.cora.document.ASCII;
@@ -280,5 +281,25 @@ public class WebgraphConfiguration extends SchemaConfiguration implements Serial
}
} catch (final IOException e) {}
}
+
+
+
+ /**
+ * Convert a SolrDocument to a SolrInputDocument.
+ * This is useful if a document from the search index shall be modified and indexed again.
+ * This shall be used as replacement of ClientUtils.toSolrInputDocument because we remove some fields
+ * which are created automatically during the indexing process.
+ * @param doc the solr document
+ * @return a solr input document
+ */
+ public SolrInputDocument toSolrInputDocument(SolrDocument doc) {
+ SolrInputDocument sid = new SolrInputDocument();
+ for (String name: doc.getFieldNames()) {
+ if (this.contains(name)) { // check each field if enabled in local Solr schema
+ sid.addField(name, doc.getFieldValue(name), 1.0f);
+ }
+ }
+ return sid;
+ }
}