Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

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

regere4f49fb17596
diff --git a/source/net/yacy/search/snippet/ResultEntry.java b/source/net/yacy/search/snippet/ResultEntry.java
index de5e4d95f..7da5c0858 100644
--- a/source/net/yacy/search/snippet/ResultEntry.java
+++ b/source/net/yacy/search/snippet/ResultEntry.java
@@ -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