Skip to content

Commit

Permalink
Use absolute values of scores in PolinessScheduler domain priority queue
Browse files Browse the repository at this point in the history
  • Loading branch information
aecio committed Jun 16, 2017
1 parent 6f2cca5 commit 785dbf3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/focusedCrawler/link/PolitenessScheduler.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public DomainNode(String domainName, long lastAccessTime) {
this.domainName = domainName;
this.lastAccessTime = lastAccessTime;
int initialCapacity = 50;
this.links = new PriorityQueue<LinkRelevance>(initialCapacity, LinkRelevance.DESC_ORDER_COMPARATOR);
this.links = new PriorityQueue<LinkRelevance>(initialCapacity, LinkRelevance.DESC_ABS_ORDER_COMPARATOR);
}

public boolean isEmpty() {
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/focusedCrawler/link/frontier/LinkRelevance.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ public int compare(LinkRelevance o1, LinkRelevance o2) {
return Double.compare(o2.getRelevance(), o1.getRelevance());
}
};

public static Comparator<LinkRelevance> DESC_ABS_ORDER_COMPARATOR = new Comparator<LinkRelevance>() {
@Override
public int compare(LinkRelevance o1, LinkRelevance o2) {
return Double.compare(Math.abs(o2.getRelevance()), Math.abs(o1.getRelevance()));
}
};

@JsonDeserialize(using = UrlDeseralizer.class)
private URL url;
Expand Down

0 comments on commit 785dbf3

Please sign in to comment.