int etAl = -1;
String orderfield = "";
boolean ascending = false;
Context context = UIUtil.obtainContext(request);
DiscoverResult docs = null;
long docsNumFound = 0;
if (types.keySet().contains(type))
{
start = UIUtil.getIntParameter(request,
"start" + getTypes().get(type).getComponentIdentifier());
// can't start earlier than 0 in the results!
if (start < 0)
{
start = 0;
}
sortBy = getSortBy(request, type);
order = getOrder(request, type);
rpp = getRPP(request, type);
etAl = getEtAl(request, type);
orderfield = sortBy != -1 ? "bi_sort_" + sortBy + "_sort" : null;
ascending = SortOption.ASCENDING.equalsIgnoreCase(order);
// Perform the search
docs = search(context, type, cris, start, rpp, orderfield,
ascending);
if (docs != null)
{
docsNumFound = docs.getTotalSearchResults();
}
}
if ((docs == null || docsNumFound == 0) && activeTypes.size() > 0)
{
type = activeTypes.get(0)[0];
sortBy = getSortBy(request, type);
order = getOrder(request, type);
rpp = getRPP(request, type);
etAl = getEtAl(request, type);
orderfield = sortBy != -1 ? "bi_sort_" + sortBy + "_sort" : null;
ascending = SortOption.ASCENDING.equalsIgnoreCase(order);
docs = search(context, type, cris, start, rpp, orderfield,
ascending);
if (docs != null)
{
docsNumFound = docs.getTotalSearchResults();
}
}
// Pass in some page qualities
// total number of pages