limiting the limit var on last page so cache will not re-try search
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 29 Jun 2006 17:20:18 +0000 (17:20 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 29 Jun 2006 17:20:18 +0000 (17:20 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@4842 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/skin/default/js/result_common.js

index 07693db..488eb7c 100644 (file)
@@ -55,11 +55,13 @@ function resultCollectSearchIds( type, method, handler ) {
                item_form = (getItemForm()) ? getItemForm().split(/,/) : null;
        }
 
+       var limit = (resultFetchAllRecords) ? 1000 : getDisplayCount();
+       if( getHitCount() > 0 && (getOffset() + getDisplayCount()) > getHitCount() ) 
+               limit = getHitCount() - getOffset();
+
        args.org_unit = getLocation();
        args.depth    = getDepth();
-       /*args.limit    = 200;*/
-       args.limit    = (resultFetchAllRecords) ? 1000 : getDisplayCount();
-       /*args.limit    = 500;*/
+       args.limit    = limit;
        args.offset   = getOffset();
 
        if(sort) args.sort = sort;
@@ -72,8 +74,6 @@ function resultCollectSearchIds( type, method, handler ) {
        if(getLitForm()) args.lit_form  = getLitForm().split(/,/);
        if(getLanguage()) args.language = getLanguage().split(/,/);
 
-       //alert('form = ' + item_form + ' : type = ' + item_type);
-
        //alert(js2JSON(args));
        var req = new Request(method, args);
        req.callback(handler);