diff --git a/source/net/yacy/cora/federate/solr/responsewriter/GSAResponseWriter.java b/source/net/yacy/cora/federate/solr/responsewriter/GSAResponseWriter.java index 0eb5f6ad4..55f8bacd9 100644 --- a/source/net/yacy/cora/federate/solr/responsewriter/GSAResponseWriter.java +++ b/source/net/yacy/cora/federate/solr/responsewriter/GSAResponseWriter.java @@ -67,6 +67,7 @@ public class GSAResponseWriter implements QueryResponseWriter { RK, // Provides a ranking number used internally by the search appliance. ENT_SOURCE, // Identifies the application ID (serial number) of the search appliance that contributes to a result. Example: S5-KUB000F0ADETLA FS, // Additional details about the search result. + R, // details of an individual search result. S, // The snippet for the search result. Query terms appear in bold in the results. Line breaks are included for proper text wrapping. LANG, // Indicates the language of the search result. The LANG element contains a two-letter language code. HAS; // Encapsulates special features that are included for this search result. @@ -211,11 +212,24 @@ public class GSAResponseWriter implements QueryResponseWriter { DocIterator iterator = response.iterator(); String urlhash = null; for (int i = 0; i < responseCount; i++) { - writer.write(""); writer.write(lb); int id = iterator.nextDoc(); Document doc = searcher.doc(id, SOLR_FIELDS); List fields = doc.getFields(); int fieldc = fields.size(); + + // pre-scan the fields to get the mime-type + String mime = ""; + for (int j = 0; j < fieldc; j++) { + Fieldable value = fields.get(j); + String fieldName = value.name(); + if (YaCySchema.content_type.getSolrFieldName().equals(fieldName)) { + mime = value.stringValue(); + break; + } + } + + // write the R header for a search result + writer.write(" 0 ? " MIME=\"" + mime + "\"" : "") + ">"); writer.write(lb); List texts = new ArrayList(); String description = ""; int size = 0;