// FIXME Add exception handling
ResourceURI uri = new PageURIImpl(site, path, id, version);
WebUrl url = new WebUrlImpl(site, path);
PageSearchResultItemImpl result = new PageSearchResultItemImpl(uri, url, relevance, site, metadata);
if (metadataMap.get(XML) != null)
result.setResourceXml((String) metadataMap.get(XML).getValues().get(0));
if (metadataMap.get(HEADER_XML) != null)
result.setPageHeaderXml((String) metadataMap.get(HEADER_XML).getValues().get(0));
if (metadataMap.get(PREVIEW_XML) != null)
result.setPagePreviewXml((String) metadataMap.get(PREVIEW_XML).getValues().get(0));
return result;
}