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"}),
ttl(new String[]{"ttl"}),
docs(new String[]{"docs"}),
size(new String[]{"size","length"}),
size(new String[]{"size","length","yacy:size"}),
lon(new String[]{"geo:lon",Geo.Long.getURIref()}),
lat(new String[]{Geo.Lat.getURIref()});
//point("gml:pos,georss:point,coordinates");
private Set<String> keys;
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
* @return a score map of urls
*/
public ScoreMap<String> getResults() {
final ScoreMap<String> scores = new ConcurrentScoreMap<String>();
public ScoreMap<RSSMessage> getResults() {
final ScoreMap<RSSMessage> scores = new ConcurrentScoreMap<RSSMessage>();
final int m = this.threads.size();
for (final Map.Entry<RSSMessage, List<Integer>> entry: this.result.entrySet()) {
int a = 0;
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;
}
@ -166,9 +166,9 @@ public class SearchHub {
addSRURSSServices(search, SRURSSServicesList, 100, CacheStrategy.CACHEONLY, false, "searchhub");
try {Thread.sleep(100);} catch (final InterruptedException e1) {}
search.waitTermination();
final ScoreMap<String> result = search.getResults();
final Iterator<String> i = result.keys(true);
String u;
final ScoreMap<RSSMessage> result = search.getResults();
final Iterator<RSSMessage> i = result.keys(true);
RSSMessage u;
while (i.hasNext()) {
u = i.next();
System.out.println("[" + result.get(u) + "] " + u);

Loading…
Cancel
Save