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

@ -141,10 +141,10 @@ public class webstructure {
IndexCell<CitationReference> citationReferences = sb.index.urlCitation();
ReferenceContainer<CitationReference> citations = null;
// citationReferences.count(urlhash) would give to the number of references good for ranking
try {
citations = citationReferences.get(urlhash, null);
} catch (IOException e) {
}
try {
citations = citationReferences != null ? citationReferences.get(urlhash, null) : null;
} catch (IOException e) {
}
if (citations != null) {
prop.put("citations_count", 1);
prop.put("citations_documents", 1);

@ -126,7 +126,7 @@ public class yacydoc {
prop.putXML("yacy_referrer_url", (le == null) ? "" : le.url().toNormalform(true));
prop.put("yacy_size", entry.size());
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_outbound", entry.lother());

@ -163,7 +163,8 @@ public class ResultEntry implements Comparable<ResultEntry>, Comparator<ResultEn
return this.urlentry.size();
}
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() {
return this.urlentry.llocal();

Loading…
Cancel
Save