Solved

back button to the previous search page?

Posted on 2004-04-16
16
195 Views
Last Modified: 2013-12-24
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
Comment
Question by:lyrix1999
  • 5
  • 5
  • 5
  • +1
16 Comments
 
LVL 35

Expert Comment

by:mrichmon
ID: 10846319
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
 
LVL 18

Expert Comment

by:Plucka
ID: 10847491
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
 
LVL 17

Expert Comment

by:Tacobell777
ID: 10847802
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
 
LVL 18

Expert Comment

by:Plucka
ID: 10847810
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
 
LVL 18

Expert Comment

by:Plucka
ID: 10856560
lyrix1999,

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

Regards
Plucka
0
 

Author Comment

by:lyrix1999
ID: 10859620
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
 

Author Comment

by:lyrix1999
ID: 10859712
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
 
LVL 17

Expert Comment

by:Tacobell777
ID: 10863101
<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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:lyrix1999
ID: 10863172
Hi Tacobell, thanks, that's certainly good to know.

However the <cfsearch> tag doesn't come with the cachedwithin property...
0
 
LVL 18

Expert Comment

by:Plucka
ID: 10864489
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
 
LVL 17

Expert Comment

by:Tacobell777
ID: 10866527
If its caching verity queries your after you might do a Query of Query and cache that result...

0
 
LVL 17

Accepted Solution

by:
Tacobell777 earned 75 total points
ID: 10866530
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
 
LVL 18

Assisted Solution

by:Plucka
Plucka earned 50 total points
ID: 10866549
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
 

Author Comment

by:lyrix1999
ID: 10871832
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
 
LVL 17

Expert Comment

by:Tacobell777
ID: 10871983
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
 

Author Comment

by:lyrix1999
ID: 10903553
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now