Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 208
  • Last Modified:

back button to the previous search page?

To help the performance, when we designed our full text search function, we didn't query the server every time users go to next search result page, instead we run our query once to return enough number of records and the "previous"/"next" button in the result page are all written in JAVA Script to dynamically display the information without interactive with our server. When the page is initially generated, we display the first 10 records, then users can use the DHTML features to switch pages.

It works great but the only problem is that everytime when users decide the searched link is not what they are looking for then they click the browser back button, it goes to the first page of search result, not the page they were at before linked to the specific article.

I am not surprised but is there any way around to get the "normal" behavior except for querying the server every time they got to the "next page"?

I hope I explained my problem. Any idea is appreciated!
0
lyrix1999
Asked:
lyrix1999
  • 5
  • 5
  • 5
  • +1
2 Solutions
 
mrichmonCommented:
You can add a "New Search" link

You can add a search box at the top or bottom of each result page like GOogle does - where it executes a new search from the results page

You can add your own back button.

etc..
0
 
PluckaCommented:
Use

window.location.replace

instead of

window.location.assign

to control navigation of the pages.

this way they user will not be able to use the back button.
0
 
Tacobell777Commented:
Personally I think its not very efficient retrieving all the records and hide them in the page, depending on what they are searching but I know with google you probably look at the first page only and then perform a new search, so this is a waste of the time it takes the user to download all results.

I would retrieve only those records displayed on the page the user is on and use the proper navigation system, i.e. not with JavaScript.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
PluckaCommented:
Depends on the application.

If it's on a LAN it would be fine, but agree with Tacobell, it would be better to cache the query and return the specific rows that you want each time, especially if a user has to run this page over the internet.
0
 
PluckaCommented:
lyrix1999,

Any luck, there are some other options also if you need more help.

Regards
Plucka
0
 
lyrix1999Author Commented:
Tacobell, I believe most of the search engine does what you said, basically it pulls the result from server everytime. Plucka, you are absolutely right, it'd be a better choice on internet. But the problem I am having is a LAN setup, good bandwidth and a little bit overloaded web server and an overloaded back end database server where we store session, client variables. The way verity pulls result (order by scores) makes me wonder if there is any difference on the server performance by return 10 records vs. 50 records. That's why we were using JAVA script to do the "next page" thing.

I think when I use JAVA script at client side, the page information cannot be saved into a session or client variable. (or can it?). Therefore the only way to get that information to the server is when I do window.location to bring up the information page, I need to put pagenumber into the URL. And then provide a "back" button on the information, it'd be my last choice and I wanted to see what ideas you guys have.

Plucka, what other options in your mind?

Thanks,
Lyrix
0
 
lyrix1999Author Commented:
Plucka, you mentioned "cache the query", how do you that? The only thing I found on the CF admin page is on the "cache page"

Limit the maximum number of cached queries on the server to  queries
Limits the maximum number of cached queries that the server will maintain. Cached queries allow for retrieval of result sets from memory rather than through a database transaction. Since the queries reside in memory, and query result set sizes differ, there must be some user imposed limit to the number of queries that are cached. When this value is exceeded, the oldest query is dropped from the cache and is replaced with the specified query.

Is this what you are talking about? Can it cache the verity search result as well? The current setting is 100, what's the regular setting on this?
0
 
Tacobell777Commented:
<cfquery name="myQuery" datasource="yourDSN" cachedwithin="#createTimeSpan(0,8,0,0)#"></cfquery>


This is how you cache a query.

It can cache anything you perform within <cfquery name="myQuery" datasource="yourDSN" cachedwithin="#createTimeSpan(0,8,0,0)#"></cfquery>
0
 
lyrix1999Author Commented:
Hi Tacobell, thanks, that's certainly good to know.

However the <cfsearch> tag doesn't come with the cachedwithin property...
0
 
PluckaCommented:
Oh,,

Sorry didn't realise you were searching a verity collection. Caching queries works on <CFQUERY

One simple solution to your problem is to open the search results in a window. When opening a window you determine the paramaters of the window, so you can turn off the buttons etc.
0
 
Tacobell777Commented:
If its caching verity queries your after you might do a Query of Query and cache that result...

0
 
Tacobell777Commented:
for example, if q if the name of your verity query

<cfquery name="myQuery" dbtype="query" cachedwithin="#createTimeSpan(0,8,0,0)#">
SELECT *
FROM q
</cfquery>
0
 
PluckaCommented:
Tacobell777,

Very clever Taco. You would then want to ensure that you didn't run your verity search.

<cfif NOT IsDefined("myQuery")>
    VERITY SEARCH (Q)
</cfif>

Regards
Plucka
0
 
lyrix1999Author Commented:
mmm... I just tried the query of verity route, and get the following error

The tag has an invalid attribute combination: the following required attributes have not been provided: (DATASOURCE).

I think it probably has something to do with the earlier version I am using (CF4.5), Looks like the <cfquery> was meant to query a database only, "query" was not even a meaningful argument for dbtype based on the document.

anyway I doubt if this method will work, I mean if you cache the query then if you changed the cateria of verity search, does it mean you will have to encode the collection name and search cateria into the "my query" name, otherwise, how would it know it's a new search? Then if I have so many searches from all over, it will probably eat up all server my memories?

Thoughts?
0
 
Tacobell777Commented:
It propably won't work in 4.5, caching is for paging remember the functionality you were after?
It will do a new search everytime the criteria changes, displays the same result if the criteria does not change.

Last thing you can do to cache the result is to put it in the SESSION scope.

Good luck...
0
 
lyrix1999Author Commented:
Thanks for both of your help. Even though it doesn't seem to be the solution to this specifc problem, I did learn something new..
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 5
  • 5
  • 5
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now