-
Immediately display the first hit from a search
In some instances, it would be useful if we could set up a search (probably embedded in a link) that would search and then immediately display the first page found from the search, rather than display a page of search results.
Does anyone know how to do this?
Pete
Last edited by pebraham; 04-18-2012 at 07:13 PM.
-
This is the "I'm feeling lucky" feature from Google. It isn't a feature of the Zoom software, you need to display the results before selecting one of the results.
It could be done with some additional scripting. The script would need to work out which result was the 1st result, check for some type 'flag' that would indicate that an auto-redirect should take place, then do the redirect. You would also need to work out when and how the flag should be set.
-
Well, I'll have a go at scripting.
Do you have any hints on how I can get the URL of the first result ?
Pete
-
You need to decide what type of scripting you are going to do. Server side or client side, and what script option in Zoom you are going to use.
-
-
Look for the comments "Display the results", from here on in, you can access the very first result, as seen with the code at the start of the loop, so it would be something like:
ipage = output(0, 0)
pgdata = GetPageData(ipage)
url = pgdata(PAGEDATA_URL)
Hope that helps.
-
Thanks! Works nicely.
In the end we inserted some javascript in the output buffer, let zoomsearch send the display results to the client, which runs the script when it displays the results:
OutResBuf = OutResBuf & "<script> window.open('" & urlToDisplay & "', '_self') </script>" & VbCrLf
Peter
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules