SolrDocumentList docList = rsp.getResults();
List<ParsedObject> resultList = new ArrayList<ParsedObject>();
for (SolrDocument doc : docList)
{
ParsedObject result = new BaseParsedObject();
addFieldsToParsedObject(doc, result);
Object type = doc.getFirstValue(ParsedObject.FIELDNAME_TYPE);
if(type != null)
{
result.setType(type.toString());
}
Object key = doc.getFirstValue(ParsedObject.FIELDNAME_KEY);
if(key != null)
{
result.setKey(key.toString());
}
Object description = doc.getFirstValue(ParsedObject.FIELDNAME_DESCRIPTION);
if(description != null)
{
result.setDescription(description.toString());
}
Object title = doc.getFirstValue(ParsedObject.FIELDNAME_TITLE);
if(title != null)
{
result.setTitle(title.toString());
}
Object content = doc.getFirstValue(ParsedObject.FIELDNAME_CONTENT);
if(content != null)
{
result.setContent(content.toString());
}
Object language = doc.getFirstValue(ParsedObject.FIELDNAME_LANGUAGE);
if (language != null)
{
result.setLanguage(language.toString());
}
Object classname = doc.getFirstValue(ParsedObject.FIELDNAME_CLASSNAME);
if (classname != null)
{
result.setClassName(classname.toString());
}
Object url = doc.getFirstValue(ParsedObject.FIELDNAME_URL);
if (url != null)
{
result.setURL(new URL(url.toString()));
}
Collection<Object> keywords = doc.getFieldValues(ParsedObject.FIELDNAME_KEYWORDS);
if(keywords != null)
{
String[] keywordArray = new String[keywords.size()];
int index = 0;
for (Object keyword : keywords)
{
keywordArray[index++] = keyword.toString();
}
result.setKeywords(keywordArray);
}
resultList.add(result);
}