diff --git a/htroot/api/push_p.html b/htroot/api/push_p.html index febf7eca3..d179f3e79 100644 --- a/htroot/api/push_p.html +++ b/htroot/api/push_p.html @@ -26,19 +26,28 @@
#[count]#
Data
-
+
data-#[count]#=
URL
-
- -
Last-Modified
-
- -
Content-Type
-
+
url-#[count]#=
Collection
-
+
collection-#[count]#=
+ +
Last-Modified
+ +
responseHeader-#[count]#=
+ +
Content-Type
+ +
responseHeader-#[count]#=
+ +
The following attributes are only used for media type content
+
Media-Title
+
responseHeader-#[count]#=
+ +
Media-Keywords ()
+
responseHeader-#[count]#=
#{/input}# diff --git a/htroot/api/push_p.java b/htroot/api/push_p.java index 2c29b7418..bcb0002f3 100644 --- a/htroot/api/push_p.java +++ b/htroot/api/push_p.java @@ -83,6 +83,15 @@ public class push_p { responseHeader.put(HeaderFramework.LAST_MODIFIED, lastModified); responseHeader.put(HeaderFramework.CONTENT_TYPE, contentType); responseHeader.put(HeaderFramework.CONTENT_LENGTH, Long.toString(data.length)); + // add generic fields + String[] responseHeaderMap = post.getParams("responseHeader-" + i); // strings with key-value pairs; separated by ':' + for (String kv: responseHeaderMap) { + int p = kv.indexOf(':'); + if (p < 0) continue; + String key = kv.substring(0, p).trim(); + String value = kv.substring(p + 1).trim(); + responseHeader.put(key, value); + } CrawlProfile profile = sb.crawler.getPushCrawlProfile(collection); // create requests and artificial response diff --git a/source/net/yacy/cora/protocol/HeaderFramework.java b/source/net/yacy/cora/protocol/HeaderFramework.java index 8b6e9cd91..969ccaff2 100644 --- a/source/net/yacy/cora/protocol/HeaderFramework.java +++ b/source/net/yacy/cora/protocol/HeaderFramework.java @@ -107,10 +107,12 @@ public class HeaderFramework extends TreeMap implements Map titles = document.titles(); if (allAttr || contains(CollectionSchema.title)) { + if (doctype == Response.DT_IMAGE || doctype == Response.DT_AUDIO || doctype == Response.DT_MOVIE) { + String mediatitle = responseHeader.get(HeaderFramework.X_YACY_MEDIA_TITLE, ""); + if (mediatitle.length() > 0) { + if (titles.size() == 0) titles.add(mediatitle); else titles.set(0, mediatitle); + } + } add(doc, CollectionSchema.title, titles); if ((allAttr || contains(CollectionSchema.title_exact_signature_l)) && titles.size() > 0) { add(doc, CollectionSchema.title_exact_signature_l, EnhancedTextProfileSignature.getSignatureLong(titles.get(0))); @@ -473,7 +479,13 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri if (document.getDate().before(lastModified)) lastModified = document.getDate(); add(doc, CollectionSchema.last_modified, lastModified); } - if (allAttr || contains(CollectionSchema.keywords)) add(doc, CollectionSchema.keywords, document.dc_subject(' ')); + if (allAttr || contains(CollectionSchema.keywords)) { + String keywords = document.dc_subject(' '); + if (doctype == Response.DT_IMAGE || doctype == Response.DT_AUDIO || doctype == Response.DT_MOVIE) { + keywords = responseHeader.get(HeaderFramework.X_YACY_MEDIA_KEYWORDS, keywords); + } + add(doc, CollectionSchema.keywords, keywords); + } if (allAttr || contains(CollectionSchema.synonyms_sxt)) { List synonyms = condenser.synonyms(); add(doc, CollectionSchema.synonyms_sxt, synonyms);