Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8625597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:49:39+00:00 2026-06-12T07:49:39+00:00

Some background The system in question has some ten thousand records which the user

  • 0

Some background

The system in question has some ten thousand records which the user is allowed to browse or search through a “massive” array of different search criteria. The result is then displayed in a paginated table ranging from a few pages to every result in the database.

If the user has made a lot of filtering and ended up with a result and clicks an arbitrary record she is then taken to a new view /edit/{record_id} where she can view all the details of said record. It’s easy to go back to the last search result at any time, as the criteria is retained in the search bar, but:

What I’m trying to achieve

If the user is to do a lot of changes based on the search result, it would be very convenient with previous and next buttons to access the adjacent records without returning to the result.

I’ve been able to do this on a basic level using ids

SELECT table.*, pn.p as previous_question, pn.n as next_question
   from table,
   (
       SELECT id, lead(id) OVER w as n, lag(id) OVER w as p
       FROM table
       window w as (order by id $order)
   ) as pn
   where table.id = $id
       and pn.id = $id

This obviously only works for the simplest of cases where the records are in the same order as in the database. What I want is for them to work in every case of data order. Needless to say, the are nearly infinite ways to sort this data.

What I’ve been thinking

Create some kind of function/tool that will let me keep the SQL from the search and perform it again like above, only with search criteria and offset in stead of ids

Save a list of the order of all the records in the result, either in the $_SESSION, database or somewhere else, and then simply traverse the list to get the ids I need.

Tools at hand

PHP, PostgreSQL, JS/jQuery.

TL;DR

I want to be able to get to the next search result without returning to go back to the search, no matter how many times the user clicks “next”.

———-

Any input would be appreciated. Links to relevant articles, ways to approach this or even the whole shebang ;). It would also be nice to be able to solve this without eating all the servers memory, or excess db access, although resources aren’t really an issue here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:49:41+00:00Added an answer on June 12, 2026 at 7:49 am

    I’m just going to throw it out there… You should use Solr or something similar particularly if this a SAS and exposed to many users.

    Basically trying to keep track of a paginated search result and then traversing will cause lots of state management in your app.

    The idea with Solr (or even just plain postgres) is to do a start and size for your search (aka OFFSET and LIMIT). Solr does this so fast its hardly a performance problem. Just make sure for Solr or Postgres you do a predictable sort by (aka ORDER BY).

    If your worried about new items being added throwing off the pagination thats simply a: WHERE create time stamp is less than when we did the initial search.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First some background : I'm writing a system that occasionally has to send out
Some background, I've been designing a user profile for our Django database system and
This has some lengthy background before the actual question, however, it bears some explaining
Some background: we have a windows application (c#) that locate in the system try.
Just some background, sorry so long winded. I'm using the System.Data.SQLite ADO.net adapter to
Some background: I've created a Swing application which uses the Substance LaF (Thanks again,
Some background I'm currently working on a mobile site so I keep switching user
I was wondering if somebody has some insight on this issue. A little background
Some background info I am programming in a system that uses a proprietary programming
[Background Story] I am working with a 5 year old user identification system, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.