Hello,

I have a question about how I am searching through a products database. What I am wanting to do is store the result set so that I can provide a link to go back to previous searches quickly, and also manipulate it quickly. If I had a flat catalog of pages I could index the content in a few tables and go with that, but I want the results to be customizable, and more flexible than ten links to ten items on ten different pages. I want the results delivered and recombined in one page.

Currently what I am doing is the following:

 1. I open an SQL statement with delimiters
 2. I circulate through the entries and append to a array called
    $pageset both the item number and a ranking based on keywords etc.
 3. I sort the array by relevance ranking
 4. I figure out what my limit and offset are in my array and paginate
    based on user input.
 5. I grab the 20 or so array elements within the range and create a
    new array called $display set.
 6. For each of the current page items I pull the full item details
    from the database and propagate the array to my html template


I wonder if instead of propagating the $pageset (results index) array every time I could store the $pageset array as a cookie or session variable.

It is a small array with a few hundred elements and rankings, but if I could store it, I wouldn't have to build the array and do a relevancy sort every time I paginate to the next page. I would just take the current stored search array which is already sorted, and grab element x through element y. Would this be an efficient way using a session variable?

Does anybody else handle search results in a similar way?

-Brian Anderson

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to