Link to home
Start Free TrialLog in
Avatar of lyrix1999
lyrix1999

asked on

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!
Avatar of mrichmon
mrichmon

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..
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.
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.
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.
lyrix1999,

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

Regards
Plucka
Avatar of lyrix1999

ASKER

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
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?
<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>
Hi Tacobell, thanks, that's certainly good to know.

However the <cfsearch> tag doesn't come with the cachedwithin property...
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.
If its caching verity queries your after you might do a Query of Query and cache that result...

ASKER CERTIFIED SOLUTION
Avatar of Tacobell777
Tacobell777

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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?
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...
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..