Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

automatically removed Places autotagging if no location library is wanted

orbiterd86d2be5c328
diff --git a/htroot/DictionaryLoader_p.java b/htroot/DictionaryLoader_p.java
index 03c79d4a5..2749a00b1 100644
--- a/htroot/DictionaryLoader_p.java
+++ b/htroot/DictionaryLoader_p.java
@@ -316,10 +316,18 @@ public class DictionaryLoader_p {
}
// check status again
+ boolean keepPlacesTagging = false;
for (final LibraryProvider.Dictionary dictionary: LibraryProvider.Dictionary.values()) {
- prop.put(dictionary.nickname + "Status", dictionary.file().exists() ? 1 : dictionary.fileDisabled().exists() ? 2 : 0);
+ int newstatus = dictionary.file().exists() ? 1 : dictionary.fileDisabled().exists() ? 2 : 0;
+ if (newstatus == 1) keepPlacesTagging = true;
+ prop.put(dictionary.nickname + "Status", newstatus);
}
+ // if all locations are deleted or deactivated, remove also the vocabulary
+ if (!keepPlacesTagging) {
+ LibraryProvider.autotagging.removePlaces();
+ }
+
return prop; // return rewrite values for templates
}
}
diff --git a/source/net/yacy/cora/language/synonyms/AutotaggingLibrary.java b/source/net/yacy/cora/language/synonyms/AutotaggingLibrary.java
index 8d1789e5f..35fa9b768 100644
--- a/source/net/yacy/cora/language/synonyms/AutotaggingLibrary.java
+++ b/source/net/yacy/cora/language/synonyms/AutotaggingLibrary.java
@@ -110,7 +110,7 @@ public class AutotaggingLibrary {
}
public void addPlaces(Locations locations) {
- if (locations.isEmpty()) return; // otherwise we get a navigation that does nothing
+ if (locations.isEmpty()) return; // otherwise we get a navigation that does nothing
Tagging voc = new Tagging("Locations", locations);
try {
voc.setObjectspace("http://dbpedia.org/resource/");
@@ -122,6 +122,10 @@ public class AutotaggingLibrary {
}
}
+ public void removePlaces() {
+ this.vocabularies.remove("Locations");
+ }
+
public int size() {
return this.vocabularies.size();
}