PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

Immediately display the first hit from a search

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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; Apr-18-2012, 07:13 PM.

  • #2
    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.

    Comment


    • #3
      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

      Comment


      • #4
        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.

        Comment


        • #5
          Server side ASP

          Comment


          • #6
            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

            Comment


            • #7
              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

              Comment

              Working...
              X