fix: no results with configuration citation reference index switched off

- urlcitationindex != null check added to ResultEntry.referencesCount
- plus other places where conflicting procedure was used (and urlcitationindex not already checked != null)
pull/1/head
reger 12 years ago
parent fe50702eb0
commit f301336adf

@ -142,7 +142,7 @@ public class webstructure {
ReferenceContainer<CitationReference> citations = null; ReferenceContainer<CitationReference> citations = null;
// citationReferences.count(urlhash) would give to the number of references good for ranking // citationReferences.count(urlhash) would give to the number of references good for ranking
try { try {
citations = citationReferences.get(urlhash, null); citations = citationReferences != null ? citationReferences.get(urlhash, null) : null;
} catch (IOException e) { } catch (IOException e) {
} }
if (citations != null) { if (citations != null) {

@ -126,7 +126,7 @@ public class yacydoc {
prop.putXML("yacy_referrer_url", (le == null) ? "" : le.url().toNormalform(true)); prop.putXML("yacy_referrer_url", (le == null) ? "" : le.url().toNormalform(true));
prop.put("yacy_size", entry.size()); prop.put("yacy_size", entry.size());
prop.put("yacy_words", entry.wordCount()); prop.put("yacy_words", entry.wordCount());
prop.put("yacy_citations", sb.index.urlCitation().count(entry.hash())); prop.put("yacy_citations", sb.index.urlCitation()!= null ? sb.index.urlCitation().count(entry.hash()) : 0);
prop.put("yacy_inbound", entry.llocal()); prop.put("yacy_inbound", entry.llocal());
prop.put("yacy_outbound", entry.lother()); prop.put("yacy_outbound", entry.lother());

@ -163,7 +163,8 @@ public class ResultEntry implements Comparable<ResultEntry>, Comparator<ResultEn
return this.urlentry.size(); return this.urlentry.size();
} }
public int referencesCount() { public int referencesCount() {
return this.indexSegment.urlCitation().count(this.urlentry.hash()); // urlCitationIndex index might be null (= configuration option)
return this.indexSegment.urlCitation() != null ? this.indexSegment.urlCitation().count(this.urlentry.hash()) : 0;
} }
public int llocal() { public int llocal() {
return this.urlentry.llocal(); return this.urlentry.llocal();

Loading…
Cancel
Save