for searchresults with empty title use filename as title

- to not store a title in index which isn't extracted from source 
  the title is empty check only added to ResultEntry class
pull/1/head
reger 11 years ago
parent f4172cbb3d
commit e4f49fb175

@ -141,7 +141,12 @@ public class ResultEntry implements Comparable<ResultEntry>, Comparator<ResultEn
return (this.alternative_urlname == null) ? MultiProtocolURL.unescape(this.urlentry.url().toNormalform(true)) : this.alternative_urlname;
}
public String title() {
return this.urlentry.dc_title();
String titlestr = this.urlentry.dc_title();
// if title is empty use filename as title
if (titlestr.isEmpty()) { // if url has no filename, title is still empty (e.g. "www.host.com/" )
titlestr = this.urlentry.url() != null ? this.urlentry.url().getFileName() : "";
}
return titlestr;
}
public String publisher() {
// dc:publisher

Loading…
Cancel
Save