From acd98bebb7b553007666ccccd4aa92fc5e366ec2 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Mon, 26 Nov 2012 15:18:51 +0100 Subject: [PATCH] improvements in GSA result writer --- .../federate/solr/responsewriter/GSAResponseWriter.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/source/net/yacy/cora/federate/solr/responsewriter/GSAResponseWriter.java b/source/net/yacy/cora/federate/solr/responsewriter/GSAResponseWriter.java index 08b1b3277..e88f4c73d 100644 --- a/source/net/yacy/cora/federate/solr/responsewriter/GSAResponseWriter.java +++ b/source/net/yacy/cora/federate/solr/responsewriter/GSAResponseWriter.java @@ -216,12 +216,10 @@ public class GSAResponseWriter implements QueryResponseWriter { 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++) { - IndexableField value = fields.get(j); + for (IndexableField value: fields) { String fieldName = value.name(); if (YaCySchema.content_type.getSolrFieldName().equals(fieldName)) { mime = value.stringValue(); @@ -235,8 +233,7 @@ public class GSAResponseWriter implements QueryResponseWriter { String description = ""; int size = 0; boolean title_written = false; // the solr index may contain several; we take only the first which should be the visible tag in - for (int j = 0; j < fieldc; j++) { - IndexableField value = fields.get(j); + for (IndexableField value: fields) { String fieldName = value.name(); // apply generic matching rule @@ -284,6 +281,7 @@ public class GSAResponseWriter implements QueryResponseWriter { size = value.stringValue() != null && value.stringValue().length() > 0 ? Integer.parseInt(value.stringValue()) : -1; continue; } + //System.out.println("superfluous field: " + fieldName + ": " + value.stringValue()); // this can be avoided setting the enableLazyFieldLoading = false in solrconfig.xml } // compute snippet from texts List snippet = urlhash == null ? null : snippets.get(urlhash);