Reload search results or load another "page".

        Parameters
        ----------
        forward : bool or None, optional
            Whether move forwards or backwards (``True`` or ``False``). If ``None``, then first page is loaded.
975569
def updateResults(self, forward=None):

        

        # this choses data we need.
        files = lambda x: {
            i['snippet']['title'].replace('/', '\\'): YTStor(
                {'yid': i['id']['videoId'], 'pub_date': i['snippet']['publishedAt']},
                opts=self.yts_opts) for i in x['items']
        }
        descs = lambda x: {
            (i['snippet']['title'].replace('/', '\\') + '.txt'): YTMetaStor(
                {
                    'title': i['snippet']['title'],
                    'yid': i['id']['videoId'],
                    'desc': i['snippet']['description'],
                    'channel': i['snippet']['channelTitle'],
                    'pub_date': i['snippet']['publishedAt']
                },
                opts=dict()
            ) for i in x['items']
        }
        thumbs = lambda x: {
            (i['snippet']['title'].replace('/', '\\') + '.jpg'): YTMetaStor(
                {'url': i['snippet']['thumbnails']['high']['url'], 'pub_date': i['snippet']['publishedAt']}, opts=dict()
            ) for i in x['items']
        }

        try:
            if self.adj_tokens[forward] is None: # in case someone would somehow cross boundary.
                forward = None
        except KeyError:
            pass

        recv = None
        try:
            try:
                data = self.avail_files[ self.adj_tokens[forward] ] # maybe data is already available locally.
            except KeyError:
                recv = self.__search( self.adj_tokens[forward] ) # nope, we have to search.
        except KeyError: # wrong index in adj_tokens

            if forward is None:
                recv = self.__search()
            else:
                raise ValueError("Valid values for forward are True, False or None (default).")

        if recv is not None:

            _d = files(recv)
            if self.preferences['metadata']['desc']: _d.update(descs(recv))
            if self.preferences['metadata']['thumb']: _d.update(thumbs(recv))

            data = (None, _d) # little format unification.

        if len(self.avail_files) > 4:

            pop = self.avail_files.popitem(False) # get rid of the oldest data.
            for s in pop[1][1].values(): s.clean()

        adj_t = deepcopy(self.adj_tokens) # this will we write to avail_files, now we update self.adj_tokens.

        if data[0] is None: # get tokens from obtained results.
            try:
                self.adj_tokens[False] = recv['prevPageToken']
            except KeyError:
                self.adj_tokens[False] = None

            try:
                self.adj_tokens[True] = recv['nextPageToken']
            except KeyError:
                self.adj_tokens[True] = None

        else: # already in avail_files.
            self.adj_tokens = data[0]

        if forward is not None:
            # backup last results in avail_files:
            self.avail_files[ self.adj_tokens[not forward] ] = (adj_t, self.visible_files)

        self.visible_files = data[1]
1035178
public void loadNextPage() {
        this.currentPage = cachedPage;
        cachedPage = null;
        this.items.addAll(currentPage.items());
        cachePage(currentPage.nextPageLink());
    }
51001
def first(self):
        

        if not self._stream:
            raise InvalidUsage('first() is only available when stream=True')

        try:
            content = next(self.all())
        except StopIteration:
            raise NoResults("No records found")

        return content
1086181
def search_previous(self):
        

        pattern = self.get_selected_text() or self.__search_pattern
        if not pattern:
            return False

        return self.search(pattern, **{"case_sensitive": True,
                                       "whole_word": False,
                                       "regular_expressions": False,
                                       "backward_search": True,
                                       "wrap_around": True})
1361143
public void savePreviousPageInfo( ActionForward forward, ActionForm form, ActionMapping mapping,
                                      HttpServletRequest request, ServletContext servletContext,
                                      boolean isSpecialForward )
    {
    }
994675
def has_next_page(self):
        
        return self.current_page < math.ceil(self.total_count / self.per_page)
72099
def first(self):
        """"""
        if self._results_cache:
            return self._results_cache[0]

        query = PaginatedResponse(func=self._func, lwrap_type=self._lwrap_type, **self._kwargs)
        try:
            return next(query)
        except StopIteration:
            return None
335055
protected boolean lookahead() {
        assert next == null : "looking ahead when next is already loaded";
        while(inner.hasNext()) {
            next = transform(inner.next());
            if(next!=null) {
                return true;
            }
        }
        noteExhausted();
        return false;
    }
1372436
def next_page(self):
        
        if self.page.has_next():
            self.query_dict['page'] = self.page.next_page_number()
            return "%s?%s" % (self.path, urlencode(self.query_dict))
        return ""
717417
def next_page
      raise Ork::NoNextPage.new 'There is no next page' unless has_next_page?

      self.class.new(@model,
                     @index,
                     @query,
                     @options.merge(continuation: keys.continuation))
    end
13537
def next_page(self):
        
        for link in self.links:
            if link.rel.lower() == 'next':
                return self._load(link.href)
        raise PaginationError('No more entries.')
1359455
def previous_page(self):
        
        if self.page.has_previous():
            previous = self.page.previous_page_number()
            if previous == 1:
                if 'page' in self.query_dict:
                    del self.query_dict['page']
            else:
                self.query_dict['page'] = previous
            return "%s?%s" % (self.path, urlencode(self.query_dict))
        return ""
13735
async def async_get(self, url):
        
        self.reset()
        self.next_link = url
        return await self.async_advance_page()
1339126
public ActionForward doReturnToPage( FlowControllerHandlerContext context, PreviousPageInfo prevPageInfo,
                                         PageFlowController currentPageFlow, ActionForm currentForm,
                                         String actionName, Forward pageFlowFwd )
    {
        assert context.getRequest() instanceof HttpServletRequest : "don't support ServletRequest currently.";
        HttpServletRequest request = ( HttpServletRequest ) context.getRequest();
        
        if ( prevPageInfo == null )
        {
            if ( _log.isInfoEnabled() )
            {
                _log.info( "Attempted return-to-page, but previous page info was missing." );
            }
        
            PageFlowException ex = new NoPreviousPageException( actionName, pageFlowFwd, currentPageFlow );
            InternalUtils.throwPageFlowException( ex, request );
        }
        
        //
        // Figure out what URI to return to, and set the original form in the request or session.
        //        
        ActionForward retFwd = prevPageInfo.getForward();
        ActionMapping prevMapping = prevPageInfo.getMapping();
        
        //
        // Restore any forms that are specified by this Forward (overwrite the original forms).
        //
        if ( retFwd instanceof Forward )
        {
            PageFlowUtils.setOutputForms( prevMapping, ( Forward ) retFwd, request, false );
            InternalUtils.addActionOutputs( ( ( Forward ) retFwd ).getActionOutputs(), request, false );
        }
        
        //
        // If the user hit the previous page directly (without going through an action), prevMapping will be null.
        //
        if ( prevMapping != null )
        {
            //
            // If the currently-posted form is of the right type, initialize the page with that (but we don't overwrite
            // the form that was set above).
            //
            if ( currentForm != null ) PageFlowUtils.setOutputForm( prevMapping, currentForm, request, false );
        
            //
            // Initialize the page with the original form it got forwarded (but we don't overwrite the form that was
            // set above).
            //
            InternalUtils.setFormInScope( prevMapping.getName(), prevPageInfo.getForm(), prevMapping, request, false );
        }
            
        //
        // If we're forwarding to a page in a different pageflow, we need to make sure the returned ActionForward has
        // the right module path, and that it has contextRelative=true.
        //
        FlowController flowController = context.getFlowController();
        
        if ( ! retFwd.getContextRelative() && flowController != currentPageFlow )
        {

            retFwd = new ActionForward( retFwd.getName(),
                                        currentPageFlow.getModulePath() + retFwd.getPath(),
                                        retFwd.getRedirect(),
                                        true );

        }
        
        if ( _log.isDebugEnabled() )
        {
            _log.debug( "Return-to-page in PageFlowController " + flowController.getClass().getName()
                       + ": original URI " + retFwd.getPath() );
        }
        
        if ( retFwd != null )
        {
            //
            // If the new (return-to) Forward specifies a redirect value explicitly, use that; otherwise
            // use the redirect value from the original Forward.
            //
            if ( pageFlowFwd.hasExplicitRedirectValue() ) retFwd.setRedirect( pageFlowFwd.getRedirect() );
            
            //
            // If there's a query string, override the previous query string.
            //
            String fwdPath = retFwd.getPath();
            String newQueryString = pageFlowFwd.getQueryString();
            int existingQueryPos = fwdPath.indexOf( '?' );
            
            //
            // If the new Forward (the one with Jpf.NavigateTo.currentPage/previousPage) has a query string, use that.
            // Otherwise, if the old Forward has no query string, restore the one from the PreviousPageInfo if
            // appropriate.
            //
            if ( newQueryString != null )
            {
                // Chop off the old query string if necessary.
                if ( existingQueryPos != -1 ) fwdPath = fwdPath.substring( 0, existingQueryPos );
                retFwd.setPath( fwdPath + newQueryString );
            }
            else if ( existingQueryPos == -1 )
            {
                retFwd.setPath( fwdPath + getQueryString( pageFlowFwd, prevPageInfo ) );
            }
        }
        
        PageFlowRequestWrapper.get( request ).setPreviousPageInfo( prevPageInfo );
        return retFwd;
    }
1001598
def _has_next_page(self):
        
        if self.page_number == 0:
            return True

        if self.max_results is not None:
            if self.num_results >= self.max_results:
                return False

        # Note: intentionally a falsy check instead of a None check. The RPC
        # can return an empty string indicating no more pages.
        return True if self.next_page_token else False
676010
def forward(self, **kwargs):
        
        # rewrite url path  
        prefix = self.url_prefix
        path= "" if request.path == "/" else request.path
        path = path[len(prefix):]
        url = '%s%s'% ( self.url_root[:-1], path )

        if request.method == 'GET':
            resp = requests.get(url, params=request.args)
            data = json.loads(resp.content)
        elif request.method == 'POST':
            if request.headers['Content-Type'].startswith('application/json'):
                # data in JSON
                resp = requests.post(url, json=request.json)
                data = request.json
            else :
                resp = requests.post(url, json=request.form)
                data = request.form
            data = json.loads(resp.content)
        else:
            # method not allowed aborting
            abort(405) # XXX

        return jsonify(data)
432032
@Override
    public int searchBackwards(String searchTerm, int startIndex, boolean startsWith)
    {
        ListIterator<jline.console.history.History.Entry> it = this.getHistory().entries(startIndex);
        while (it.hasPrevious()) {
            jline.console.history.History.Entry e = it.previous();
            String itemNormalized = e.value().toString().toLowerCase();
            String termNormalized = searchTerm.toLowerCase();
            if (startsWith) {
                if (itemNormalized.startsWith(termNormalized)) {
                    return e.index();
                }
            }
            else {
                if (itemNormalized.contains(termNormalized)) {
                    return e.index();
                }
            }
        }
        return -1;
    }