}
// Copy hits to the result list
int hitCount = hits.length();
Document doc = null;
SearchResults results = new SearchResults(hitCount);
for (int counter = 0; counter < hitCount; counter++)
{
ParsedObject result = new BaseParsedObject();
try
{
doc = hits.doc(counter);
addFieldsToParsedObject(doc, result);
result.setScore(hits.score(counter));
Field type = doc.getField(ParsedObject.FIELDNAME_TYPE);
if(type != null)
{
result.setType(type.stringValue());
}
Field key = doc.getField(ParsedObject.FIELDNAME_KEY);
if(key != null)
{
result.setKey(key.stringValue());
}
Field description = doc.getField(ParsedObject.FIELDNAME_DESCRIPTION);
if(description != null)
{
result.setDescription(description.stringValue());
}
Field title = doc.getField(ParsedObject.FIELDNAME_TITLE);
if(title != null)
{
result.setTitle(title.stringValue());
}
Field content = doc.getField(ParsedObject.FIELDNAME_CONTENT);
if(content != null)
{
result.setContent(content.stringValue());
}
Field language = doc.getField(ParsedObject.FIELDNAME_LANGUAGE);
if (language != null)
{
result.setLanguage(language.stringValue());
}
Field classname = doc.getField(ParsedObject.FIELDNAME_CLASSNAME);
if (classname != null)
{
result.setClassName(classname.stringValue());
}
Field url = doc.getField(ParsedObject.FIELDNAME_URL);
if (url != null)
{
result.setURL(new URL(url.stringValue()));
}
results.add(counter, result);
}
catch (Exception ioe)
{
logger.error("Exception", ioe);
}