Added config switches for custom parser

Conflicts:
	source/net/yacy/document/TextParser.java
pull/1/head
cominch 13 years ago committed by Michael Peter Christen
parent b5a8fb5fd8
commit 90512640bf

@ -1056,7 +1056,8 @@ federated.service.solr.indexing.schemefile = solr.keys.default.list
triplestore.persistent = false
# Augmentation settings
parserAugmentation = true
parserAugmentation = false
parserAugmentation.RDFa = false
proxyAugmentation = false
augmentation.reflect = false
augmentation.addDoctype = false

@ -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>

@ -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;
}
}

@ -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>

@ -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>

@ -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() {

Loading…
Cancel
Save