revert clickservlet

(default was indeed a mistakenly)
pull/1/head
reger 10 years ago
parent 61ae9d2d11
commit 4eb89d7f15

@ -55,23 +55,7 @@
<param-value>YaCy stop proxy</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>ClickServlet</servlet-name>
<servlet-class>net.yacy.http.servlets.ClickServlet</servlet-class>
<init-param>
<param-name>clickaction</param-name>
<param-value>index</param-value> <!-- options: index crawl crawllinks -->
<description>defines the action to perform with supplied url</description>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>ClickServlet</servlet-name>
<url-pattern>/click</url-pattern>
</servlet-mapping>
<!-- mappings activated by the application - hardcoded (added here for completness) -->
<servlet-mapping>
<servlet-name>SolrSelectServlet</servlet-name>

@ -826,7 +826,6 @@ search.result.show.proxy = false
search.result.show.hostbrowser = true
search.result.show.vocabulary = false
search.result.useclickservlet = false
# search navigators: comma-separated list of default values for search navigation.
# can be temporary different if search string is given with differen navigation values

@ -69,13 +69,6 @@
<input type="checkbox" name="remotesearch.result.store" value="true" #(remotesearch.result.store)#::checked="checked"#(/remotesearch.result.store)# /> add remote search results to the local index <b>( default=on, it is recommended to enable this option ! )</b>
</dd>
#(remotesearch.result.store)#
<dt>Use Click-Servlet for search result links</dt>
<dd>
<input type="checkbox" name="search.result.useclickservlet" value="true" #(search.result.useclickservlet)#::checked="checked"#(/search.result.useclickservlet)# /> allows YaCy to perform some actions if user clicks on a search result (by default add the clicked link to the index)
</dd>
::#(/remotesearch.result.store)#
<dt>Default Pop-Up Page</dt>
<dd>
<input type="radio" name="popup" value="status" #(popupStatus)#::checked="checked"#(/popupStatus)# />Status Page&nbsp;

@ -93,8 +93,6 @@ public class ConfigPortal {
final boolean storeresult = post.getBoolean(SwitchboardConstants.REMOTESEARCH_RESULT_STORE);
sb.setConfig(SwitchboardConstants.REMOTESEARCH_RESULT_STORE, storeresult);
// click servlet only meaningful if result not stored (currently)
sb.setConfig(SwitchboardConstants.SEARCH_USECLICKSERVLET, !storeresult && post.getBoolean(SwitchboardConstants.SEARCH_USECLICKSERVLET));
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY, post.get("search.verify", "ifexist"));
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY_DELETE, post.getBoolean("search.verify.delete"));
@ -150,7 +148,6 @@ public class ConfigPortal {
sb.setConfig("search.options", config.getProperty("search.options","true"));
sb.setConfig(SwitchboardConstants.GREEDYLEARNING_ACTIVE, config.getProperty(SwitchboardConstants.GREEDYLEARNING_ACTIVE));
sb.setConfig(SwitchboardConstants.REMOTESEARCH_RESULT_STORE, config.getProperty(SwitchboardConstants.REMOTESEARCH_RESULT_STORE));
sb.setConfig(SwitchboardConstants.REMOTESEARCH_RESULT_STORE+"_"+SwitchboardConstants.SEARCH_USECLICKSERVLET, config.getProperty(SwitchboardConstants.SEARCH_USECLICKSERVLET));
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY, config.getProperty(SwitchboardConstants.SEARCH_VERIFY,"iffresh"));
sb.setConfig(SwitchboardConstants.SEARCH_VERIFY_DELETE, config.getProperty(SwitchboardConstants.SEARCH_VERIFY_DELETE,"true"));
sb.setConfig("about.headline", config.getProperty("about.headline",""));
@ -173,7 +170,6 @@ public class ConfigPortal {
prop.put(SwitchboardConstants.GREEDYLEARNING_LIMIT_DOCCOUNT, sb.getConfig(SwitchboardConstants.GREEDYLEARNING_LIMIT_DOCCOUNT, "0"));
prop.put(SwitchboardConstants.REMOTESEARCH_RESULT_STORE, sb.getConfigBool(SwitchboardConstants.REMOTESEARCH_RESULT_STORE, true) ? 1 : 0);
prop.put(SwitchboardConstants.REMOTESEARCH_RESULT_STORE+"_"+SwitchboardConstants.SEARCH_USECLICKSERVLET, sb.getConfigBool(SwitchboardConstants.SEARCH_USECLICKSERVLET, false) ? 1 : 0);
prop.put("search.navigation.hosts", sb.getConfig("search.navigation", "").indexOf("hosts",0) >= 0 ? 1 : 0);
prop.put("search.navigation.authors", sb.getConfig("search.navigation", "").indexOf("authors",0) >= 0 ? 1 : 0);

@ -181,8 +181,6 @@ public class yacysearchitem {
}
}
prop.putXML("content_link", modifyURL); // putXML for rss
} else if (sb.getConfigBool(SwitchboardConstants.SEARCH_USECLICKSERVLET, false)) {
prop.putXML("content_link", "click?url="+resultUrlstring); // putXML for rss
} else {
prop.putXML("content_link", resultUrlstring); // putXML for rss
}

@ -1,146 +0,0 @@
/**
* ClickServlet
* Copyright 2014 by reger
* First released 04.01.2015 at http://yacy.net
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program in the file lgpl21.txt If not, see
* <http://www.gnu.org/licenses/>.
*/
package net.yacy.http.servlets;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.yacy.cora.document.id.DigestURL;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants;
/**
* The ClickServlet is used as search result link to perform additional actions
* upon click on the link by user. The actual target url is given as parameter,
* the servlet forwards the user to the target link page and performs additonal
* actions with the target url (basically alternative of using javascript
* href.onClick() )
*
* Request Parameter: url= the target User browser is forwarded to the url using
* html header or javascript afterwards performs configured actions,
*
* Actions e.g. (0- = not implemented yet)
* - crawl/recrawl the url
* - crawl all links on page (with depth) / site
* 0- increase/create rating
* 0- add to a collection
* 0- connect query and url
* 0- learn and classify content - promote rating
* 0- add to click statistic url/cnt (maybe to use for boost)
*/
public class ClickServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
// config switches to remember actions to perform
String _actionCode = "index";
static final String crawlaction = "crawl"; // actionCode to add url to crawler with crawldepth=0
static final String indexaction = "index"; // actionCode to add url to index (=default)
static final String crawllinksaction = "crawllinks"; // actionCode to add url to crawler with crawldepth=1
@Override
public void init() {
if (this.getInitParameter("clickaction") != null) {
_actionCode = this.getInitParameter("clickaction");
}
}
@Override
public void service(ServletRequest request, ServletResponse response) throws IOException, ServletException {
HttpServletRequest hrequest = (HttpServletRequest) request;
HttpServletResponse hresponse = (HttpServletResponse) response;
final String strUrl = hrequest.getParameter("url");
if (strUrl == null) {
hresponse.sendError(HttpServletResponse.SC_NOT_FOUND, "url parameter missing");
return;
}
try {
hresponse.setStatus(HttpServletResponse.SC_OK);
/* alternative to use javascript / http-equiv header
hresponse.setStatus(HttpServletResponse.SC_TEMPORARY_REDIRECT);
hresponse.setHeader(HeaderFramework.LOCATION, strUrl);
*/
// output html forward to url header
PrintWriter pw = response.getWriter();
response.setContentType("text/html");
pw.println("<html>");
pw.println("<head>");
pw.print("<script>window.location.replace(\"");
pw.print(strUrl);
pw.println("\");</script>");
pw.print("<noscript><META http-equiv=\"refresh\" content=\"0; URL=");
pw.print(strUrl);
pw.println("\"></noscript>");
pw.println("</head></html>");
pw.close();
if (Switchboard.getSwitchboard().getConfigBool(SwitchboardConstants.SEARCH_USECLICKSERVLET, false)) {
// do click event action
if (_actionCode != null) {
switch (_actionCode) {
case crawlaction: {
final Collection<DigestURL> urls = new ArrayList<DigestURL>();
urls.add(new DigestURL(strUrl));
Switchboard.getSwitchboard().addToCrawler(urls, false);
break;
}
case indexaction: {
final Collection<DigestURL> urls = new ArrayList<DigestURL>();
urls.add(new DigestURL(strUrl));
Switchboard.getSwitchboard().addToIndex(urls, null, null, null, true);
break;
}
case crawllinksaction: {
final Collection<DigestURL> urls = new ArrayList<DigestURL>();
urls.add(new DigestURL(strUrl));
Switchboard.getSwitchboard().addToCrawler(urls, false);
Switchboard.getSwitchboard().heuristicSearchResults(strUrl);
break;
}
}
}
}
} catch (Exception e) {
ConcurrentLog.logException(e);
}
}
}

@ -526,8 +526,6 @@ public final class SwitchboardConstants {
public static final String SEARCH_VERIFY = "search.verify";
public static final String SEARCH_VERIFY_DELETE = "search.verify.delete";
public static final String SEARCH_USECLICKSERVLET = "search.result.useclickservlet"; // resultlink via click servlet
/**
* ranking+evaluation
*/

Loading…
Cancel
Save