From 4cd56d39664afee46e52e3a4f55d809f49168048 Mon Sep 17 00:00:00 2001
From: orbiter
Date: Tue, 11 May 2010 23:06:39 +0000
Subject: [PATCH] - fix for
http://forum.yacy-websuche.de/viewtopic.php?p=20036#p20036 - enhancement to
kml search
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6867 6c8d7289-2bf4-0310-a012-ef5d649a1542
---
htroot/index.java | 10 +++++-----
htroot/yacysearch.java | 14 +++++++-------
htroot/yacysearch_location.java | 20 ++++++++------------
htroot/yacysearch_location.kml | 6 ++----
htroot/yacysearch_location.xml | 6 ++----
5 files changed, 24 insertions(+), 32 deletions(-)
diff --git a/htroot/index.java b/htroot/index.java
index fde3de1b6..5d14b8ae1 100644
--- a/htroot/index.java
+++ b/htroot/index.java
@@ -126,12 +126,12 @@ public class index {
prop.put("searchdomswitches_searchvideo", sb.getConfigBool("search.video", true) ? 1 : 0);
prop.put("searchdomswitches_searchimage", sb.getConfigBool("search.image", true) ? 1 : 0);
prop.put("searchdomswitches_searchapp", sb.getConfigBool("search.app", true) ? 1 : 0);
+ prop.put("searchdomswitches_searchtext_check", (contentdom == ContentDomain.TEXT) ? "1" : "0");
+ prop.put("searchdomswitches_searchaudio_check", (contentdom == ContentDomain.AUDIO) ? "1" : "0");
+ prop.put("searchdomswitches_searchvideo_check", (contentdom == ContentDomain.VIDEO) ? "1" : "0");
+ prop.put("searchdomswitches_searchimage_check", (contentdom == ContentDomain.IMAGE) ? "1" : "0");
+ prop.put("searchdomswitches_searchapp_check", (contentdom == ContentDomain.APP) ? "1" : "0");
prop.put("searchoptions_display", display);
- prop.put("searchtext_check", (contentdom == ContentDomain.TEXT) ? "1" : "0");
- prop.put("searchaudio_check", (contentdom == ContentDomain.AUDIO) ? "1" : "0");
- prop.put("searchvideo_check", (contentdom == ContentDomain.VIDEO) ? "1" : "0");
- prop.put("searchimage_check", (contentdom == ContentDomain.IMAGE) ? "1" : "0");
- prop.put("searchapp_check", (contentdom == ContentDomain.APP) ? "1" : "0");
// online caution timing
sb.localSearchLastAccess = System.currentTimeMillis();
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index 59b2393e8..6866fe836 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -580,9 +580,9 @@ public class yacysearch {
try {
synchronized (trackerHandles) {
trackerHandles.add(theQuery.handle);
- if (trackerHandles.size() > 1000) trackerHandles.remove(trackerHandles.first());
- sb.localSearchTracker.put(client, trackerHandles);
+ while (trackerHandles.size() > 600) if (!trackerHandles.remove(trackerHandles.first())) break;
}
+ sb.localSearchTracker.put(client, trackerHandles);
if (sb.localSearchTracker.size() > 1000) sb.localSearchTracker.remove(sb.localSearchTracker.keys().nextElement());
} catch (Exception e) {
Log.logException(e);
@@ -691,11 +691,11 @@ public class yacysearch {
prop.put("searchdomswitches_searchvideo", sb.getConfigBool("search.video", true) ? 1 : 0);
prop.put("searchdomswitches_searchimage", sb.getConfigBool("search.image", true) ? 1 : 0);
prop.put("searchdomswitches_searchapp", sb.getConfigBool("search.app", true) ? 1 : 0);
- prop.put("searchtext_check", (contentdom == ContentDomain.TEXT) ? "1" : "0");
- prop.put("searchaudio_check", (contentdom == ContentDomain.AUDIO) ? "1" : "0");
- prop.put("searchvideo_check", (contentdom == ContentDomain.VIDEO) ? "1" : "0");
- prop.put("searchimage_check", (contentdom == ContentDomain.IMAGE) ? "1" : "0");
- prop.put("searchapp_check", (contentdom == ContentDomain.APP) ? "1" : "0");
+ prop.put("searchdomswitches_searchtext_check", (contentdom == ContentDomain.TEXT) ? "1" : "0");
+ prop.put("searchdomswitches_searchaudio_check", (contentdom == ContentDomain.AUDIO) ? "1" : "0");
+ prop.put("searchdomswitches_searchvideo_check", (contentdom == ContentDomain.VIDEO) ? "1" : "0");
+ prop.put("searchdomswitches_searchimage_check", (contentdom == ContentDomain.IMAGE) ? "1" : "0");
+ prop.put("searchdomswitches_searchapp_check", (contentdom == ContentDomain.APP) ? "1" : "0");
// for RSS: don't HTML encode some elements
prop.putXML("rss_query", originalquerystring);
diff --git a/htroot/yacysearch_location.java b/htroot/yacysearch_location.java
index 2dbb4358c..8a6e22a1e 100644
--- a/htroot/yacysearch_location.java
+++ b/htroot/yacysearch_location.java
@@ -62,11 +62,12 @@ public class yacysearch_location {
for (String s: message.getSubject()) subject += " " + s;
words += subject;
for (String word: words.split(" ")) if (word.length() >= 3) locations.addAll(LibraryProvider.geoDB.find(word, true, true, false, false, false));
+
+ String locnames = "";
+ for (Location location: locations) locnames += ", " + location.getName();
+ if (locations.size() > 0) locnames = locnames.substring(2);
- if (locations.size() > 0) {
- String locnames = "";
- for (Location location: locations) locnames += ", " + location.getName();
- locnames = locnames.substring(2);
+ for (Location location: locations) {
// write for all locations a point to this message
prop.put("kml_placemark_" + placemarkCounter + "_location", locnames);
prop.put("kml_placemark_" + placemarkCounter + "_name", message.getTitle());
@@ -76,14 +77,9 @@ public class yacysearch_location {
prop.put("kml_placemark_" + placemarkCounter + "_description", message.getDescription());
prop.put("kml_placemark_" + placemarkCounter + "_date", message.getPubDate());
prop.put("kml_placemark_" + placemarkCounter + "_url", message.getLink());
- int pc = 0;
- for (Location location: locations) {
- prop.put("kml_placemark_" + placemarkCounter + "_point_" + pc + "_name", location.getName());
- prop.put("kml_placemark_" + placemarkCounter + "_point_" + pc + "_lon", location.lon());
- prop.put("kml_placemark_" + placemarkCounter + "_point_" + pc + "_lat", location.lat());
- pc++;
- }
- prop.put("kml_placemark_" + placemarkCounter + "_point", pc);
+ prop.put("kml_placemark_" + placemarkCounter + "_pointname", location.getName());
+ prop.put("kml_placemark_" + placemarkCounter + "_lon", location.lon());
+ prop.put("kml_placemark_" + placemarkCounter + "_lat", location.lat());
placemarkCounter++;
if (placemarkCounter >= maximumRecords) break loop;
}
diff --git a/htroot/yacysearch_location.kml b/htroot/yacysearch_location.kml
index a8272e530..28a29943b 100644
--- a/htroot/yacysearch_location.kml
+++ b/htroot/yacysearch_location.kml
@@ -3,14 +3,12 @@
#{placemark}#
- #[name]#
+
Location: #[location]#
Author: #[author]#
Publisher: #[copyright]#
Subject: #[subject]#
Abstract: #[description]#
Source: #[url]#
]]>
- #{point}#
- #[name]#
+ #[pointname]#
#[lon]#,#[lat]#
- #{/point}#
#[date]#
diff --git a/htroot/yacysearch_location.xml b/htroot/yacysearch_location.xml
index a8272e530..28a29943b 100644
--- a/htroot/yacysearch_location.xml
+++ b/htroot/yacysearch_location.xml
@@ -3,14 +3,12 @@
#{placemark}#
- #[name]#
+
Location: #[location]#Author: #[author]#
Publisher: #[copyright]#
Subject: #[subject]#
Abstract: #[description]#
Source: #[url]#
]]>
- #{point}#
- #[name]#
+ #[pointname]#
#[lon]#,#[lat]#
- #{/point}#
#[date]#