fixed null pointer exception during search

see http://www.yacy-forum.de/viewtopic.php?p=16429#16429


git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1547 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent 1fce0ea263
commit 45323e7b76

@ -76,14 +76,13 @@ public class plasmaSearchRankingProfile {
public String[] order; public String[] order;
private HashMap coeff; private HashMap coeff;
public plasmaSearchRankingProfile(String[] order) { public plasmaSearchRankingProfile() {
this.order = order; // set some default-values
this.order = null;
this.coeff = new HashMap(); this.coeff = new HashMap();
for (int i = 0; i < 3; i++) { coeff.put(ENTROPY, new Integer(4));
if (this.order[i].equals(plasmaSearchRankingProfile.ORDER_QUALITY)) coeff.put(ENTROPY, new Integer((4 * (3 - i)))); coeff.put(DATE, new Integer(8));
else if (this.order[i].equals(plasmaSearchRankingProfile.ORDER_DATE)) coeff.put(DATE, new Integer((4 * (3 - i)))); coeff.put(YBR, new Integer(12));
else if (this.order[i].equals(plasmaSearchRankingProfile.ORDER_YBR)) coeff.put(YBR, new Integer((4 * (3 - i))));
}
coeff.put(POSINTEXT, new Integer(11)); coeff.put(POSINTEXT, new Integer(11));
coeff.put(WORDDISTANCE, new Integer(10)); coeff.put(WORDDISTANCE, new Integer(10));
coeff.put(HITCOUNT, new Integer(9)); coeff.put(HITCOUNT, new Integer(9));
@ -98,6 +97,17 @@ public class plasmaSearchRankingProfile {
coeff.put(DESCRCOMPINTOPLIST, new Integer(11)); coeff.put(DESCRCOMPINTOPLIST, new Integer(11));
} }
public plasmaSearchRankingProfile(String[] order) {
this(); // set defaults
this.order = order;
// overwrite defaults with order attributes
for (int i = 0; i < 3; i++) {
if (this.order[i].equals(plasmaSearchRankingProfile.ORDER_QUALITY)) coeff.put(ENTROPY, new Integer((4 * (3 - i))));
else if (this.order[i].equals(plasmaSearchRankingProfile.ORDER_DATE)) coeff.put(DATE, new Integer((4 * (3 - i))));
else if (this.order[i].equals(plasmaSearchRankingProfile.ORDER_YBR)) coeff.put(YBR, new Integer((4 * (3 - i))));
}
}
public String orderString() { public String orderString() {
return order[0] + "-" + order[1] + "-" + order[2]; return order[0] + "-" + order[1] + "-" + order[2];
} }

Loading…
Cancel
Save