fixed size parsing in RSS message parser (for YaCy size parameter)

pull/1/head
Michael Peter Christen 12 years ago
parent 089a03114e
commit c235d5c0f1

@ -57,11 +57,11 @@ public class RSSMessage implements Hit, Comparable<RSSMessage>, Comparator<RSSMe
guid(new String[]{"guid"}), guid(new String[]{"guid"}),
ttl(new String[]{"ttl"}), ttl(new String[]{"ttl"}),
docs(new String[]{"docs"}), docs(new String[]{"docs"}),
size(new String[]{"size","length"}), size(new String[]{"size","length","yacy:size"}),
lon(new String[]{"geo:lon",Geo.Long.getURIref()}), lon(new String[]{"geo:lon",Geo.Long.getURIref()}),
lat(new String[]{Geo.Lat.getURIref()}); lat(new String[]{Geo.Lat.getURIref()});
//point("gml:pos,georss:point,coordinates"); //point("gml:pos,georss:point,coordinates");
private Set<String> keys; private Set<String> keys;
private Token(final String[] keylist) { private Token(final String[] keylist) {

@ -102,13 +102,13 @@ public class SearchHub {
* Every time this method is called the list is re-computed to reflect the latest results * Every time this method is called the list is re-computed to reflect the latest results
* @return a score map of urls * @return a score map of urls
*/ */
public ScoreMap<String> getResults() { public ScoreMap<RSSMessage> getResults() {
final ScoreMap<String> scores = new ConcurrentScoreMap<String>(); final ScoreMap<RSSMessage> scores = new ConcurrentScoreMap<RSSMessage>();
final int m = this.threads.size(); final int m = this.threads.size();
for (final Map.Entry<RSSMessage, List<Integer>> entry: this.result.entrySet()) { for (final Map.Entry<RSSMessage, List<Integer>> entry: this.result.entrySet()) {
int a = 0; int a = 0;
for (final Integer i : entry.getValue()) a += i.intValue(); for (final Integer i : entry.getValue()) a += i.intValue();
scores.inc(entry.getKey().getLink(), a * m / entry.getValue().size()); scores.inc(entry.getKey(), a * m / entry.getValue().size());
} }
return scores; return scores;
} }
@ -166,9 +166,9 @@ public class SearchHub {
addSRURSSServices(search, SRURSSServicesList, 100, CacheStrategy.CACHEONLY, false, "searchhub"); addSRURSSServices(search, SRURSSServicesList, 100, CacheStrategy.CACHEONLY, false, "searchhub");
try {Thread.sleep(100);} catch (final InterruptedException e1) {} try {Thread.sleep(100);} catch (final InterruptedException e1) {}
search.waitTermination(); search.waitTermination();
final ScoreMap<String> result = search.getResults(); final ScoreMap<RSSMessage> result = search.getResults();
final Iterator<String> i = result.keys(true); final Iterator<RSSMessage> i = result.keys(true);
String u; RSSMessage u;
while (i.hasNext()) { while (i.hasNext()) {
u = i.next(); u = i.next();
System.out.println("[" + result.get(u) + "] " + u); System.out.println("[" + result.get(u) + "] " + u);

Loading…
Cancel
Save