Results 1 to 7 of 7

Thread: Immediately display the first hit from a search

  1. #1
    Join Date
    Apr 2011
    Location
    Sheffield, UK
    Posts
    19

    Default 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 08:13 PM.

  2. #2
    Join Date
    Dec 2004
    Location
    Sydney
    Posts
    4,307

    Default

    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.

  3. #3
    Join Date
    Apr 2011
    Location
    Sheffield, UK
    Posts
    19

    Default

    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

  4. #4
    Join Date
    Dec 2004
    Location
    Sydney
    Posts
    4,307

    Default

    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.

  5. #5
    Join Date
    Apr 2011
    Location
    Sheffield, UK
    Posts
    19

    Default

    Server side ASP

  6. #6
    Join Date
    Dec 2004
    Location
    Sydney, Australia
    Posts
    3,839

    Default

    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.
    --Ray
    Wrensoft Web Software
    Sydney, Australia
    Zoom Search Engine

  7. #7
    Join Date
    Apr 2011
    Location
    Sheffield, UK
    Posts
    19

    Default

    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
  •