summaryrefslogtreecommitdiff
path: root/htroot
diff options
context:
space:
mode:
authorMichael Peter Christen <mc@yacy.net>2012-06-18 15:19:57 +0200
committerMichael Peter Christen <mc@yacy.net>2012-06-18 15:19:57 +0200
commit24bbe359cafc8fb94cc81020cf01a64db5a5b8b7 (patch)
tree59c346b8b23a4bc3eed52de90f1022a54eaca298 /htroot
parent5a41e739b478584f2bc89ce56160af7c0cb816e0 (diff)
integrate also geonames library files for less cities. these are more
useful for tagging since less normal words are false-identified as location
Diffstat (limited to 'htroot')
-rw-r--r--htroot/DictionaryLoader_p.html72
-rw-r--r--htroot/DictionaryLoader_p.java90
2 files changed, 158 insertions, 4 deletions
diff --git a/htroot/DictionaryLoader_p.html b/htroot/DictionaryLoader_p.html
index fd48f6c6a..8d3d0fdfe 100644
--- a/htroot/DictionaryLoader_p.html
+++ b/htroot/DictionaryLoader_p.html
@@ -65,9 +65,11 @@
Geolocalization will enable YaCy to present locations from OpenStreetMap according to given search words.
<h4>GeoNames</h4>
- <p>With this file it is possible to find cities with a population > 1000 all over the world.</p>
+ <p>With this file it is possible to find cities all over the world.</p>
<dl>
+ <dt>Content</dt>
+ <dd>cities with a population > 1000 all over the world</dd>
<dt><label>Download from</label></dt>
<dd>#[geon0URL]#</dd>
<dt><label>Storage location</label></dt>
@@ -99,6 +101,74 @@
<dt>Result</dt><dd><div class="error">cannot activate dictionary file: #[error]#</div></dd>
#(/geon0ActionActivated)#
</dl>
+ <dl>
+ <dt>Content</dt>
+ <dd>cities with a population > 5000 all over the world</dd>
+ <dt><label>Download from</label></dt>
+ <dd>#[geon1URL]#</dd>
+ <dt><label>Storage location</label></dt>
+ <dd>#[geon1Storage]#</dd>
+ <dt><label>Status</label></dt>
+ <dd>#(geon1Status)#<div class="info">not loaded</div>::<div class="commit">loaded</div>::deactivated#(/geon1Status)#</dd>
+ <dt>Action</dt>
+ <dd>#(geon1Status)#
+ <input type="submit" name="geon1Load" value="Load" />::
+ <input type="submit" name="geon1Deactivate" value="Deactivate" />
+ <input type="submit" name="geon1Remove" value="Remove" />::
+ <input type="submit" name="geon1Activate" value="Activate" />
+ <input type="submit" name="geon1Remove" value="Remove" />
+ #(/geon1Status)#</dd>
+ #(geon1ActionLoaded)#::
+ <dt>Result</dt><dd><div class="commit">loaded and activated dictionary file</div></dd>::
+ <dt>Result</dt><dd><div class="error">loading of dictionary file failed: #[error]#</div></dd>
+ #(/geon1ActionLoaded)#
+ #(geon1ActionRemoved)#::
+ <dt>Result</dt><dd><div class="commit">deactivated and removed dictionary file</div></dd>::
+ <dt>Result</dt><dd><div class="error">cannot remove dictionary file: #[error]#</div></dd>
+ #(/geon1ActionRemoved)#
+ #(geon1ActionDeactivated)#::
+ <dt>Result</dt><dd><div class="commit">deactivated dictionary file</div></dd>::
+ <dt>Result</dt><dd><div class="error">cannot deactivate dictionary file: #[error]#</div></dd>
+ #(/geon1ActionDeactivated)#
+ #(geon1ActionActivated)#::
+ <dt>Result</dt><dd><div class="commit">activated dictionary file</div></dd>::
+ <dt>Result</dt><dd><div class="error">cannot activate dictionary file: #[error]#</div></dd>
+ #(/geon1ActionActivated)#
+ </dl>
+ <dl>
+ <dt>Content</dt>
+ <dd>cities with a population > 100000 all over the world (the set is is reduced to cities > 100000)</dd>
+ <dt><label>Download from</label></dt>
+ <dd>#[geon2URL]#</dd>
+ <dt><label>Storage location</label></dt>
+ <dd>#[geon2Storage]#</dd>
+ <dt><label>Status</label></dt>
+ <dd>#(geon2Status)#<div class="info">not loaded</div>::<div class="commit">loaded</div>::deactivated#(/geon2Status)#</dd>
+ <dt>Action</dt>
+ <dd>#(geon2Status)#
+ <input type="submit" name="geon2Load" value="Load" />::
+ <input type="submit" name="geon2Deactivate" value="Deactivate" />
+ <input type="submit" name="geon2Remove" value="Remove" />::
+ <input type="submit" name="geon2Activate" value="Activate" />
+ <input type="submit" name="geon2Remove" value="Remove" />
+ #(/geon2Status)#</dd>
+ #(geon2ActionLoaded)#::
+ <dt>Result</dt><dd><div class="commit">loaded and activated dictionary file</div></dd>::
+ <dt>Result</dt><dd><div class="error">loading of dictionary file failed: #[error]#</div></dd>
+ #(/geon2ActionLoaded)#
+ #(geon2ActionRemoved)#::
+ <dt>Result</dt><dd><div class="commit">deactivated and removed dictionary file</div></dd>::
+ <dt>Result</dt><dd><div class="error">cannot remove dictionary file: #[error]#</div></dd>
+ #(/geon2ActionRemoved)#
+ #(geon2ActionDeactivated)#::
+ <dt>Result</dt><dd><div class="commit">deactivated dictionary file</div></dd>::
+ <dt>Result</dt><dd><div class="error">cannot deactivate dictionary file: #[error]#</div></dd>
+ #(/geon2ActionDeactivated)#
+ #(geon2ActionActivated)#::
+ <dt>Result</dt><dd><div class="commit">activated dictionary file</div></dd>::
+ <dt>Result</dt><dd><div class="error">cannot activate dictionary file: #[error]#</div></dd>
+ #(/geon2ActionActivated)#
+ </dl>
<h4>OpenGeoDB</h4>
<p>With this file it is possible to find locations in Germany using the location (city) name, a zip code, a car sign or a telephone pre-dial number.</p>
diff --git a/htroot/DictionaryLoader_p.java b/htroot/DictionaryLoader_p.java
index c5906fdb9..70ba014ee 100644
--- a/htroot/DictionaryLoader_p.java
+++ b/htroot/DictionaryLoader_p.java
@@ -68,7 +68,7 @@ public class DictionaryLoader_p {
final Response response = sb.loader.load(sb.loader.request(new DigestURI(LibraryProvider.Dictionary.GEON0.url), false, true), CacheStrategy.NOCACHE, Integer.MAX_VALUE, false);
final byte[] b = response.getContent();
FileUtils.copy(b, LibraryProvider.Dictionary.GEON0.file());
- LibraryProvider.geoLoc.activateLocation(LibraryProvider.Dictionary.GEON0.nickname, new GeonamesLocation(LibraryProvider.Dictionary.GEON0.file(), null));
+ LibraryProvider.geoLoc.activateLocation(LibraryProvider.Dictionary.GEON0.nickname, new GeonamesLocation(LibraryProvider.Dictionary.GEON0.file(), null, -1));
LibraryProvider.autotagging.addPlaces(LibraryProvider.geoLoc);
prop.put("geon0Status", LibraryProvider.Dictionary.GEON0.file().exists() ? 1 : 0);
prop.put("geon0ActionLoaded", 1);
@@ -98,11 +98,95 @@ public class DictionaryLoader_p {
if (post.containsKey("geon0Activate")) {
LibraryProvider.Dictionary.GEON0.fileDisabled().renameTo(LibraryProvider.Dictionary.GEON0.file());
- LibraryProvider.geoLoc.activateLocation(LibraryProvider.Dictionary.GEON0.nickname, new GeonamesLocation(LibraryProvider.Dictionary.GEON0.file(), null));
+ LibraryProvider.geoLoc.activateLocation(LibraryProvider.Dictionary.GEON0.nickname, new GeonamesLocation(LibraryProvider.Dictionary.GEON0.file(), null, -1));
LibraryProvider.autotagging.addPlaces(LibraryProvider.geoLoc);
prop.put("geon0ActionActivated", 1);
}
+ // GEON1
+ if (post.containsKey("geon1Load")) {
+ // load from the net
+ try {
+ final Response response = sb.loader.load(sb.loader.request(new DigestURI(LibraryProvider.Dictionary.GEON1.url), false, true), CacheStrategy.NOCACHE, Integer.MAX_VALUE, false);
+ final byte[] b = response.getContent();
+ FileUtils.copy(b, LibraryProvider.Dictionary.GEON1.file());
+ LibraryProvider.geoLoc.activateLocation(LibraryProvider.Dictionary.GEON1.nickname, new GeonamesLocation(LibraryProvider.Dictionary.GEON1.file(), null, -1));
+ LibraryProvider.autotagging.addPlaces(LibraryProvider.geoLoc);
+ prop.put("geon1Status", LibraryProvider.Dictionary.GEON1.file().exists() ? 1 : 0);
+ prop.put("geon1ActionLoaded", 1);
+ } catch (final MalformedURLException e) {
+ Log.logException(e);
+ prop.put("geon1ActionLoaded", 2);
+ prop.put("geon1ActionLoaded_error", e.getMessage());
+ } catch (final IOException e) {
+ Log.logException(e);
+ prop.put("geon1ActionLoaded", 2);
+ prop.put("geon1ActionLoaded_error", e.getMessage());
+ }
+ }
+
+ if (post.containsKey("geon1Remove")) {
+ FileUtils.deletedelete(LibraryProvider.Dictionary.GEON1.file());
+ FileUtils.deletedelete(LibraryProvider.Dictionary.GEON1.fileDisabled());
+ LibraryProvider.geoLoc.deactivateLocalization(LibraryProvider.Dictionary.GEON1.nickname);
+ prop.put("geon1ActionRemoved", 1);
+ }
+
+ if (post.containsKey("geon1Deactivate")) {
+ LibraryProvider.Dictionary.GEON1.file().renameTo(LibraryProvider.Dictionary.GEON1.fileDisabled());
+ LibraryProvider.geoLoc.deactivateLocalization(LibraryProvider.Dictionary.GEON1.nickname);
+ prop.put("geon1ActionDeactivated", 1);
+ }
+
+ if (post.containsKey("geon1Activate")) {
+ LibraryProvider.Dictionary.GEON1.fileDisabled().renameTo(LibraryProvider.Dictionary.GEON1.file());
+ LibraryProvider.geoLoc.activateLocation(LibraryProvider.Dictionary.GEON1.nickname, new GeonamesLocation(LibraryProvider.Dictionary.GEON1.file(), null, -1));
+ LibraryProvider.autotagging.addPlaces(LibraryProvider.geoLoc);
+ prop.put("geon1ActionActivated", 1);
+ }
+
+ // GEON2
+ if (post.containsKey("geon2Load")) {
+ // load from the net
+ try {
+ final Response response = sb.loader.load(sb.loader.request(new DigestURI(LibraryProvider.Dictionary.GEON2.url), false, true), CacheStrategy.NOCACHE, Integer.MAX_VALUE, false);
+ final byte[] b = response.getContent();
+ FileUtils.copy(b, LibraryProvider.Dictionary.GEON2.file());
+ LibraryProvider.geoLoc.activateLocation(LibraryProvider.Dictionary.GEON2.nickname, new GeonamesLocation(LibraryProvider.Dictionary.GEON2.file(), null, 100000));
+ LibraryProvider.autotagging.addPlaces(LibraryProvider.geoLoc);
+ prop.put("geon2Status", LibraryProvider.Dictionary.GEON2.file().exists() ? 1 : 0);
+ prop.put("geon2ActionLoaded", 1);
+ } catch (final MalformedURLException e) {
+ Log.logException(e);
+ prop.put("geon2ActionLoaded", 2);
+ prop.put("geon2ActionLoaded_error", e.getMessage());
+ } catch (final IOException e) {
+ Log.logException(e);
+ prop.put("geon2ActionLoaded", 2);
+ prop.put("geon2ActionLoaded_error", e.getMessage());
+ }
+ }
+
+ if (post.containsKey("geon2Remove")) {
+ FileUtils.deletedelete(LibraryProvider.Dictionary.GEON2.file());
+ FileUtils.deletedelete(LibraryProvider.Dictionary.GEON2.fileDisabled());
+ LibraryProvider.geoLoc.deactivateLocalization(LibraryProvider.Dictionary.GEON2.nickname);
+ prop.put("geon2ActionRemoved", 1);
+ }
+
+ if (post.containsKey("geon2Deactivate")) {
+ LibraryProvider.Dictionary.GEON2.file().renameTo(LibraryProvider.Dictionary.GEON2.fileDisabled());
+ LibraryProvider.geoLoc.deactivateLocalization(LibraryProvider.Dictionary.GEON2.nickname);
+ prop.put("geon2ActionDeactivated", 1);
+ }
+
+ if (post.containsKey("geon2Activate")) {
+ LibraryProvider.Dictionary.GEON2.fileDisabled().renameTo(LibraryProvider.Dictionary.GEON2.file());
+ LibraryProvider.geoLoc.activateLocation(LibraryProvider.Dictionary.GEON2.nickname, new GeonamesLocation(LibraryProvider.Dictionary.GEON2.file(), null, 100000));
+ LibraryProvider.autotagging.addPlaces(LibraryProvider.geoLoc);
+ prop.put("geon2ActionActivated", 1);
+ }
+
// GEO1
if (post.containsKey("geo1Load")) {
// load from the net
@@ -110,7 +194,7 @@ public class DictionaryLoader_p {
final Response response = sb.loader.load(sb.loader.request(new DigestURI(LibraryProvider.Dictionary.GEODB1.url), false, true), CacheStrategy.NOCACHE, Integer.MAX_VALUE, false);
final byte[] b = response.getContent();
FileUtils.copy(b, LibraryProvider.Dictionary.GEODB1.file());
- LibraryProvider.geoLoc.deactivateLocalization(LibraryProvider.Dictionary.GEODB0.nickname);
+ LibraryProvider.geoLoc.deactivateLocalization(LibraryProvider.Dictionary.GEODB1.nickname);
LibraryProvider.geoLoc.activateLocation(LibraryProvider.Dictionary.GEODB1.nickname, new OpenGeoDBLocation(LibraryProvider.Dictionary.GEODB1.file(), null));
LibraryProvider.autotagging.addPlaces(LibraryProvider.geoLoc);
prop.put("geo1Status", LibraryProvider.Dictionary.GEODB1.file().exists() ? 1 : 0);