12-13-2012 10:30 AM
public static List<NodeRef> executeSPQuery(final String query, final String siteName, final String pageSize, final String skipCount, final String sortField,
final String sortOrder)
{
ResultSet resultSet = null;
List<NodeRef> listNodeRefs = null;
try
{
// For sorting and limit the result , uses searchparameters
final SearchParameters searchParameters = new SearchParameters();
searchParameters.addStore(Repository.getStoreRef());
searchParameters.setLanguage(SearchService.LANGUAGE_LUCENE);
searchParameters.setQuery(query);
searchParameters.setMaxItems(Integer.parseInt(pageSize));
searchParameters.setSkipCount(Integer.parseInt(skipCount));
searchParameters.addSort(SearchParameters.SORT_IN_DOCUMENT_ORDER_DESCENDING);
LOGGER.debug("==========Started Executing Query=======");
resultSet = AlfrescoServiceRegistry.getSearchService().query(searchParameters);
LOGGER.debug("==========Completed Executing Query=======");
if (resultSet != null && resultSet.length() > 0)
{
LOGGER.debug("====Started Getting noderefs=======");
resultSet.setBulkFetch(true);
resultSet.setBulkFetchSize(10000);
LOGGER.debug(">>>>>>>Result set size : "+resultSet.length());
listNodeRefs = resultSet.getNodeRefs();
LOGGER.debug("====Completed Getting noderefs=======");
}
}
catch (final LuceneQueryParserException e)
{
LOGGER.info("Problem in Parsing the Lucene query :: " + query, e);
return listNodeRefs;
}
catch (final Exception e)
{
LOGGER.info("Problem in Parsing the Lucene query :: " + query, e);
return listNodeRefs;
}
finally
{
if (resultSet != null)
{
resultSet.close();
resultSet = null;
}
}
return listNodeRefs;
}
12-14-2012 09:55 AM
resultSet.setBulkFetch(true);
resultSet.setBulkFetchSize(Integer.parseInt(pageSize));
listNodeRefs = resultSet.getNodeRefs();
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.