From 1ab3de08855a2b901421a08d5ab0ebaa953f5f88 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Tue, 29 May 2012 12:43:14 +0200 Subject: [PATCH] fixes to location search --- htroot/yacysearch_location.html | 10 +++++----- htroot/yacysearch_location.java | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/htroot/yacysearch_location.html b/htroot/yacysearch_location.html index 5e21d512c..71061019f 100644 --- a/htroot/yacysearch_location.html +++ b/htroot/yacysearch_location.html @@ -15,11 +15,11 @@ var map; var searchLayer_md = null; var searchLayer_co = null; - var path_mdsearch = 'yacysearch_location.rss?dom=metatag&query='; - var path_cosearch = 'yacysearch_location.rss?dom=query&query='; + var path_mdsearch = 'yacysearch_location.rss?dom=alltext&query='; + var path_losearch = 'yacysearch_location.rss?dom=location&query='; var marker_md = new OpenLayers.Icon("/env/grafics/marker_red.png", new OpenLayers.Size(11,16)); var marker_co = new OpenLayers.Icon("/env/grafics/star_yellow.png", new OpenLayers.Size(25,25)); - // possible values for dom: query,metatag,alltext,title,publisher,creator,subject + // possible values for dom: location,metatag,alltext,title,publisher,creator,subject function init() { map = new OpenLayers.Map('map', { @@ -51,7 +51,7 @@ #(initsearch)#:: var query = '#[query]#'.replace(' ', '+'); - searchLayer_co = new OpenLayers.Layer.GeoRSS('GeoRSS', path_cosearch + query, {'icon':marker_co}); + searchLayer_co = new OpenLayers.Layer.GeoRSS('GeoRSS', path_losearch + query, {'icon':marker_co}); map.addLayer(searchLayer_co); searchLayer_md = new OpenLayers.Layer.GeoRSS('GeoRSS', path_mdsearch + query, {'icon':marker_md}); map.addLayer(searchLayer_md); @@ -63,7 +63,7 @@ if (searchLayer_md != null) searchLayer_md.destroy(); if (searchLayer_co != null) searchLayer_co.destroy(); var center = map.getCenter().transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326")); - searchLayer_co = new OpenLayers.Layer.GeoRSS('GeoRSS', path_cosearch + query + '&lon=' + center.lon + '&lat=' + center.lat + '&zoom=' + map.getZoom(), {'icon':marker_co}); + searchLayer_co = new OpenLayers.Layer.GeoRSS('GeoRSS', path_losearch + query + '&lon=' + center.lon + '&lat=' + center.lat + '&zoom=' + map.getZoom(), {'icon':marker_co}); map.addLayer(searchLayer_co); searchLayer_md = new OpenLayers.Layer.GeoRSS('GeoRSS', path_mdsearch + query, {'icon':marker_md}); map.addLayer(searchLayer_md); diff --git a/htroot/yacysearch_location.java b/htroot/yacysearch_location.java index b02533fb7..efd40d928 100644 --- a/htroot/yacysearch_location.java +++ b/htroot/yacysearch_location.java @@ -54,7 +54,7 @@ public class yacysearch_location { prop.put("kml", 1); if (post == null) return prop; final String query = post.get("query", ""); - final boolean search_query = post.get("dom", "").indexOf("query",0) >= 0; + final boolean search_query = post.get("dom", "").indexOf("location",0) >= 0; final boolean metatag = post.get("dom", "").indexOf("metatag",0) >= 0; final boolean alltext = post.get("dom", "").indexOf("alltext",0) >= 0; final boolean search_title = alltext || post.get("dom", "").indexOf("title",0) >= 0; @@ -97,6 +97,7 @@ public class yacysearch_location { // take the results and compute some locations RSSMessage message; loop: while ((message = results.poll(maximumTime, TimeUnit.MILLISECONDS)) != RSSMessage.POISON) { + if (message == null) break loop; // find all associated locations final Set locations = new HashSet();