08-21-2007 05:09 AM
09-11-2009 03:59 AM
09-11-2009 08:32 AM
09-16-2009 04:04 AM
09-17-2009 05:23 AM
public Object get(Object key)
{
// execute the search
String search = key.toString();
List<TemplateNode> nodes = null;
HashSet<NodeRef> nodeRefs = new HashSet<NodeRef>();
// check if a full Lucene search string has been supplied or extracted from XML
if (search != null && search.length() != 0)
{
// perform the search against the repo
ResultSet results = null;
try
{
SearchParameters sp = new SearchParameters();
sp.addStore(this.parent.getNodeRef().getStoreRef());
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
sp.setQuery(search);
sp.addSort("CREATED", false);
sp.setLimitBy(LimitBy.FINAL_SIZE);
int limit = 20;
sp.setLimit(limit);
results = this.services.getSearchService().query(sp);
if (results.length() != 0)
{
nodes = new ArrayList<TemplateNode>(results.length());
for (ResultSetRow row : results)
{
NodeRef nodeRef = row.getNodeRef();
if (!nodeRefs.contains(nodeRef))
{
nodes.add(new TemplateNode(nodeRef, services, this.parent.getImageResolver()));
nodeRefs.add(nodeRef);
}
}
}
}
catch (Throwable err)
{
throw new AlfrescoRuntimeException("Failed to execute search: " + search, err);
}
finally
{
if (results != null)
{
results.close();
}
}
}
return nodes != null ? nodes : (List) Collections.emptyList();
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.