Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
Added config switches for custom parser
cominch90512640bf5e
diff --git a/defaults/yacy.init b/defaults/yacy.initindex ac83868db..309531a50 100644--- a/defaults/yacy.init+++ b/defaults/yacy.init@@ -1056,7 +1056,8 @@ federated.service.solr.indexing.schemefile = solr.keys.default.listtriplestore.persistent = false# Augmentation settings-parserAugmentation = true+parserAugmentation = false+parserAugmentation.RDFa = falseproxyAugmentation = falseaugmentation.reflect = falseaugmentation.addDoctype = falsediff --git a/htroot/AugmentedParsing_p.html b/htroot/AugmentedParsing_p.htmlnew file mode 100644index 000000000..2e07c9944--- /dev/null+++ b/htroot/AugmentedParsing_p.html@@ -0,0 +1,47 @@+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">+<html xmlns="http://www.w3.org/1999/xhtml">+ <head>+ <title>YaCy '#[clientname]#': Augmented Parsing</title>+ #%env/templates/metas.template%#+ </head>+ <body id="Settings">+ #%env/templates/header.template%#+ #%env/templates/submenuAugmentedParsing.template%#+ <h2>Augmented Parsing</h2>++ <form id="parsersettings" action="AugmentedParsing_p.html" method="post" enctype="multipart/form-data">+<fieldset><legend id="urlproxy">Global Status</legend>+<p>+ With this settings you can activate or deactivate augmented parsing which combines the documents with information from external sources (tags etc.).+</p>++ <dl>++ <dt><label for="content">Augmented Parser:</label></dt>+ <dd>+ <input type="checkbox" name="augmentedparserenabled" id="augmentedparserenabled" #(augmentedparserenabled_checked)#:: checked="checked"#(/augmentedparserenabled_checked)# />Enabled<br/>+ <p class="help">+ Globally enables or disables the augmented parser. This setting requires a restart.+ </p>+ </dd>++ <dt><label for="content">Augmented Parser - RDFa:</label></dt>+ <dd>+ <input type="checkbox" name="augmentedparserRDFenabled" id="augmentedparserRDFenabled" #(augmentedparserRDFenabled_checked)#:: checked="checked"#(/augmentedparserRDFenabled_checked)# />Enabled<br/>+ <p class="help">+ Globally enables or disables the RDFa parser. This setting requires a restart.+ </p>+ </dd>+++ </dl>+++ <input type="submit" name="augmentedparserSettings" value="Submit"/>+</fieldset>+</form>+++ #%env/templates/footer.template%#+ </body>+</html>diff --git a/htroot/AugmentedParsing_p.java b/htroot/AugmentedParsing_p.javanew file mode 100644index 000000000..2c36d32f5--- /dev/null+++ b/htroot/AugmentedParsing_p.java@@ -0,0 +1,39 @@+import net.yacy.cora.protocol.RequestHeader;+import de.anomic.server.serverObjects;+import de.anomic.server.serverSwitch;++public final class AugmentedParsing_p {++ public static serverObjects respond(final RequestHeader header,+ final serverObjects post, final serverSwitch env) {+ // return variable that accumulates replacements+ final serverObjects prop = new serverObjects();++ if (post != null) {++ if (post.containsKey("augmentedparserSettings")) {+++ env.setConfig("parserAugmentation",+ "on".equals(post.get("augmentedparserenabled")) ? true : false);++ env.setConfig("parserAugmentation.RDFa",+ "on".equals(post.get("augmentedparserRDFenabled")) ? true : false);+++ }+++ }++ prop.put("augmentedparserenabled_checked",+ env.getConfigBool("parserAugmentation", false) ? "1" : "0");++ prop.put("augmentedparserRDFenabled_checked",+ env.getConfigBool("parserAugmentation.RDFa", false) ? "1" : "0");++ // return rewrite properties+ return prop;+ }++}diff --git a/htroot/env/templates/header.template b/htroot/env/templates/header.templateindex 852521b42..2a83ebf8a 100644--- a/htroot/env/templates/header.template+++ b/htroot/env/templates/header.template@@ -27,6 +27,7 @@<h3>Interaction</h3><ul class="menu"><li><a href="/AugmentedBrowsing_p.html" class="MenuItemLink lock">Augmented Browsing</a></li>+ <li><a href="/AugmentedParsing_p.html" class="MenuItemLink lock">Augmented Parsing</a></li><li><a href="/Autocrawler_p.html" class="MenuItemLink lock">Auto Crawler</a></li><li><a href="/Feedback_p.html" class="MenuItemLink lock">Feedback</a></li><li><a href="/Triplestore_p.html" class="MenuItemLink lock">Triplestore</a></li>diff --git a/htroot/env/templates/submenuAugmentedParsing.template b/htroot/env/templates/submenuAugmentedParsing.templatenew file mode 100644index 000000000..4ed57c72f--- /dev/null+++ b/htroot/env/templates/submenuAugmentedParsing.template@@ -0,0 +1,6 @@+<div class="SubMenu">+ <h3>Augmented Parsing</h3>+ <ul class="SubMenu">+ <li><a href="/AugmentedParsing_p.html" class="MenuItemLink lock">Augmented Parsing</a></li>+ </ul>+</div>\ No newline at end of filediff --git a/source/net/yacy/document/TextParser.java b/source/net/yacy/document/TextParser.javaindex e586e52fa..fa984ad66 100644--- a/source/net/yacy/document/TextParser.java+++ b/source/net/yacy/document/TextParser.java@@ -66,6 +66,7 @@ import net.yacy.document.parser.rdfa.impl.RDFaParser;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.util.FileUtils;import net.yacy.kelondro.util.MemoryControl;+import net.yacy.search.Switchboard;public final class TextParser {@@ -103,11 +104,11 @@ public final class TextParser {initParser(new vsdParser());initParser(new xlsParser());initParser(new zipParser());--initParser(new RDFaParser("RDFa Parser"));initParser(new rdfParser());- initParser(new AugmentParser("Augment Parser"));++ if (Switchboard.getSwitchboard().getConfigBool("parserAugmentation.RDFa", true)) initParser(new RDFaParser("RDFa Parser"));+ if (Switchboard.getSwitchboard().getConfigBool("parserAugmentation", true)) initParser(new AugmentParser("Augment Parser"));}public static Set<Parser> parsers() {