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

  • SEARCH
  • Home
  • 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 126727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:21:49+00:00 2026-05-11T05:21:49+00:00

I currently work for a social networking website. My boss recently had the idea

  • 0

I currently work for a social networking website.

My boss recently had the idea to show search results by random instead of normal results (registration date). The problem with that is simple and obvious: if you go from one page to another, it’s going to show you different results each time as the list is randomized each time.

I had the idea to store results in database+cookies something like this:

  • Cookie containing a serialized version of the $_POST request (needed if we want to do a re-sort)
  • A table which would serve as the base for the search id => searches (id,user_id, creation_date)
  • A table which would store the results and their order => searches_results (search_id, order, user_id)

Flow chart would look like something like that:

  • After each searches I store the ‘where’ into a cookie or session
  • Then I erase the previous search in ‘searches’
  • Then I delete previous results in ‘searches_results’
  • Then I insert a row into ‘searches’ for the key
  • Then I insert each user row into ‘searches_results’
  • And finally I redirect the user to somethink like ?search_id=[search_key]

There is a big flaw here : performances …. it is definetly possible to make the system OR down OR very slow.

Any idea what would be the best to structure this ?

  • 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. 2026-05-11T05:21:50+00:00Added an answer on May 11, 2026 at 5:21 am

    What if instead of ordering randomly, you ordered by some function where the order is known and repeatable, just non-obvious? You could seed such a function with some data from the search query to make it be even less obvious that it repeats. This way, you can page back and forth through your results and always get what you expect. Music players use this sort of function for their shuffle feature (so that if you click back, you get the previous song, and if you click next again, you’re back where you started). I’m sure you can divine some function to accomplish this… bitwise XORing ID values with some constant (from the query) and then sorting by the resulting number might be sufficient. I chose XOR arbitrarily because it’s a trivially simple function that will get you repeatable and non-obvious results.

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

Sidebar

Related Questions

The software group I currently work in has recently decided to start documenting our
Afternoon. I am currently working a drink search site and started work on adding
I'm currently working on two social networking sites that have a lot in common,
I am currently working on a web app for social networking site but it
we are currently developing a website which will heavily involve connections to several social
One of the sites I work on is a social networking site of sorts,
I currently work on a tracking project using a GPS receiver and a modem
I currently work on a parser. I walk a tree, most of it being
I currently work on a magento webshop, which loads PrototypeJS as framework. However i
I currently work in an environment where reports must be emailed to users as

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.