Merge pull request #2 from Scarfmonster/master

English Synonyms and small fixes
pull/4/head
Michael Peter Christen 10 years ago
commit 0d365e67a5

File diff suppressed because one or more lines are too long

@ -71,7 +71,7 @@
<td>#[recrawlIfOlder]#</td>
<td>#{crawlingDomFilterContent}##[item]#<br />#{/crawlingDomFilterContent}#</td>
<td>#[domMaxPages]#</td>
<td>#(withQuery)#no::yes#(/withQuery)#</td>
<td>#(crawlingQ)#no::yes#(/crawlingQ)#</td>
<td>#(storeHTCache)#no::yes#(/storeHTCache)#</td>
<td>#(indexText)#no::yes#(/indexText)#</td>
<td>#(indexMedia)#no::yes#(/indexMedia)#</td>

@ -221,6 +221,16 @@
<dt>Action</dt>
<dd>#(syn0Status)#<input type="submit" name="syn0Activate" value="Activate" />::<input type="submit" name="syn0Deactivate" value="Deactivate" />#(/syn0Status)#</dd>
</dl>
<h4><a href="http://icon.shef.ac.uk/Moby/" target="_blank">Moby Lexicon - English Thesaurus from http://icon.shef.ac.uk/Moby/</a></h4>
<p>The data from this source was converted to the YaCy synonym file format and part of the YaCy distribution.</p>
<dl>
<dt><label>Status</label></dt>
<dd>#(syn1Status)#<div class="info">Deactivated</div>::<div class="commit">Activated</div>#(/syn1Status)#</dd>
<dt>Action</dt>
<dd>#(syn1Status)#<input type="submit" name="syn1Activate" value="Activate" />::<input type="submit" name="syn1Deactivate" value="Deactivate" />#(/syn1Status)#</dd>
</dl>
</fieldset>
</form>
#%env/templates/footer.template%#

@ -44,6 +44,11 @@ public class DictionaryLoader_p {
final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects(); // return variable that accumulates replacements
final File synonyms_path = new File(sb.dictionariesPath, LibraryProvider.path_to_synonym_dictionaries);
final File synonym_de_default = new File(new File(new File(sb.appPath, "addon"), "synonyms"), "openthesaurus_de_yacy");
final File synonym_de_production = new File(synonyms_path, synonym_de_default.getName());
final File synonym_en_default = new File(new File(new File(sb.appPath, "addon"), "synonyms"), "mobythesaurus_en_yacy");
final File synonym_en_production = new File(synonyms_path, synonym_en_default.getName());
/*
* distinguish the following cases:
* - dictionary file was not loaded -> actions: load the file
@ -60,11 +65,12 @@ public class DictionaryLoader_p {
prop.put(dictionary.nickname + "ActionActivated", 0);
prop.put(dictionary.nickname + "ActionDeactivated", 0);
}
if (SynonymLibrary.size() > 0) { // status of SynonymLibrary not included in above
prop.put("syn0Status", 1);
}
if (post == null) {
// check here only if there is no possibility synonym libraries have been activated/deactivated
prop.put("syn0Status", synonym_de_production.exists() ? 1 : 0);
prop.put("syn1Status", synonym_en_production.exists() ? 1 : 0);
return prop;
}
@ -289,9 +295,6 @@ public class DictionaryLoader_p {
prop.put("drw0ActionActivated", 1);
}
final File synonym_de_default = new File(new File(new File(sb.appPath, "addon"), "synonyms"), "openthesaurus_de_yacy");
final File synonyms_path = new File(sb.dictionariesPath, LibraryProvider.path_to_synonym_dictionaries);
final File synonym_de_production = new File(synonyms_path, synonym_de_default.getName());
if (post.containsKey("syn0Deactivate")) {
synonym_de_production.delete();
SynonymLibrary.init(synonyms_path);
@ -305,8 +308,27 @@ public class DictionaryLoader_p {
}
SynonymLibrary.init(synonyms_path);
}
prop.put("syn0Status", synonym_de_production.exists() ? 1 : 0);
if (post.containsKey("syn1Deactivate")) {
synonym_en_production.delete();
SynonymLibrary.init(synonyms_path);
}
if (post.containsKey("syn1Activate")) {
try {
FileUtils.copy(new FileInputStream(synonym_en_default), synonym_en_production);
} catch (IOException e) {
ConcurrentLog.logException(e);
}
SynonymLibrary.init(synonyms_path);
}
if (post != null) {
// check here if there is a possibility synonym libraries have been activated/deactivated
prop.put("syn0Status", synonym_de_production.exists() ? 1 : 0);
prop.put("syn1Status", synonym_en_production.exists() ? 1 : 0);
}
// check status again
boolean keepPlacesTagging = false;
for (final LibraryProvider.Dictionary dictionary: LibraryProvider.Dictionary.values()) {

@ -708,7 +708,6 @@ public class CrawlProfile extends ConcurrentHashMap<String, String> implements M
prop.put(CRAWL_PROFILE_PREFIX + count + "_domMaxPages", this.domMaxPages());
//prop.put(CRAWL_PROFILE_PREFIX + count + "_crawlingDomMaxPages", (this.domMaxPages() == Integer.MAX_VALUE) ? "unlimited" : Integer.toString(this.domMaxPages())); // TODO: remove, replace with 'domMaxPages'
prop.put(CRAWL_PROFILE_PREFIX + count + "_crawlingQ", this.crawlingQ() ? 1 : 0);
//prop.put(CRAWL_PROFILE_PREFIX + count + "_withQuery", (this.crawlingQ()) ? "1" : "0"); // TODO: remove, replace with crawlingQ
prop.put(CRAWL_PROFILE_PREFIX + count + "_followFrames", this.followFrames() ? 1 : 0);
prop.put(CRAWL_PROFILE_PREFIX + count + "_obeyHtmlRobotsNoindex", this.obeyHtmlRobotsNoindex() ? 1 : 0);
prop.put(CRAWL_PROFILE_PREFIX + count + "_obeyHtmlRobotsNofollow", this.obeyHtmlRobotsNofollow() ? 1 : 0);

Loading…
Cancel
Save