PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

limit the results per page

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

  • limit the results per page

    How can i set the results per page to 10? I do not want the end user to be able to change the results per page. If there are 30 results it will be on 3 pages.

  • #2
    Set this old post.
    http://www.wrensoft.com/forum/showthread.php?t=314
    The post was refering to V4 of the software, but the options and process is basically the same.

    Comment


    • #3
      Stop URL Manipulation of the result count.

      if any one is using an index other then CGI. Open the search.* page generated from zoom. Make a backup of the page and open it in Notepad.


      Search for this line
      // number of results per page, defaults to 10 if not specified

      It will look similar to this just below that line.

      if (isset($_GET['zoom_per_page']))
      {
      $per_page = intval($_GET['zoom_per_page']);
      if ($per_page < 1)
      $per_page = 1;
      }
      else
      $per_page = 10;


      Make it look like this to stop URL Manipulation of the result count. With 3 results as the max. THe 3 can be any number.


      if (isset($_GET['zoom_per_page']))
      {
      $per_page = intval($_GET['zoom_per_page']);
      if ($per_page < 1)
      $per_page = 1;
      if ($per_page > 3)
      $per_page = 3;


      }
      else
      $per_page = 3;

      Save the page and try to change the number of results via the url

      Comment


      • #4
        The original poster asked to set the number of results per page to 10. The code suggested above doesn't do this. So a simple cut and paste of the code above won't work for the original poster. You need to change the 3's to 10's.

        You still need to take care of the search form, to remove the drop down option to select the number of results. As just using this code will leave the search form as is.

        if any one is using an index other then CGI...
        The original poster didn't mention what script they were using. DON'T paste this code into the ASP script, nor the Javascript script. It won't work. It also won't work in the ASP.NET control, nor the CGI (as pointed out). The code above is PHP only.

        Further we generally recommend against modifying the code in the script, if there is another solution available (as there likely is for most people in this case). Code mods should really should be a last resort.

        The reason being is that the version of the script needs to match the version of the index files. If we release an updated script, you either need to re-apply your changes for each new release (time consuming maintenance & testing), or you eventually end up in a situation where the index files are more up to date that your custom script. Which can result in obscure and spectacular failures.

        We also don't provide support for custom scripts. If you change the script and it doesn't work for any reason you need to debug it yourself.

        So for the majority of people the solution referenced in the old post (a hidden form value in HTML) may be a better option. The downside is that people could over-type the URL to get additional serch results (the solution from selvol addresses and solved this). But this is the same for all sites, if you re-write the URL you can expect to get an error or strange behaviour from the server.

        Comment


        • #5
          Limit the # of results per page?

          Shouldn't the below code give me 6 results per page. I keep getting 10 results per page.

          Go to: www.consulting-soa.com
          Under Expert Search on the right side of the page search: cost


          <form method="get" action="/search/zoom_per_page=6.cgi">
          <input type="text" name="zoom_query" size="20" value="" class="zoom_searchbox" />
          <input type="submit" value="Submit" class="zoom_button" />

          Comment


          • #6
            Your HTML code is not valid. The action tag is wrong and you don't have a hidden field as suggested above.

            I suspect you want something more like this, with a hidden input field to select the number of results.

            <form method="get" action="/search/search.cgi">
            <input type="text" name="zoom_query" size="20" value="" class="zoom_searchbox" />
            <input type="submit" value="Submit" class="zoom_button" />
            <input type="hidden" name="zoom_per_page" value="6">
            </form>

            Comment


            • #7
              Results to display per page

              <form method="get" action="/search/search.aspx">
              <input type="text" name="zoom_query" size="20" value="" class="zoom_searchbox" />
              <input type="submit" value="Submit" class="zoom_button" />
              <input type="hidden" name="zoom_per_page" value="6">
              </form>

              Is the above code applicable in asp.net?
              I am currently using V6 and yes I did follow the V4 plus the user guide example but neither seems to work.What could be the problem?

              Comment


              • #8
                but neither seems to work
                What didn't work? The hidden field controlling the number of results or something else didn't work?

                What is the URL for your site, so we can see the problem?

                Comment


                • #9
                  If you have the form on an ASP.NET (ASPX) page then you might need to be aware of whether you have a parent <form>...</form> enclosing the whole page. In which case, adding a form within that would not work.

                  More details here:
                  Q. How do I create a search form on ASPX pages?
                  --Ray
                  Wrensoft Web Software
                  Sydney, Australia
                  Zoom Search Engine

                  Comment


                  • #10
                    cgi Need to limit Results

                    I am using CGI. I really need to limit the results number.
                    I can not have user with tha ability to inject 999 as the results per page value.

                    I am using IIS7 Win2008 .

                    DO you know of any way to do this. I am sure an URL rewrite via IIS is 1 method. Any tips are greatly appreciated.

                    How about a decompiler for the CGI?

                    Thought I's ask you first. You would know.


                    Regards
                    Z()()M USER

                    Comment


                    • #11
                      I can not have user with tha ability to inject 999 as the results per page value
                      Why? It might be a tiny amount of extra load on the server, but there shouldn't be any other effects (except the expected long page of results).

                      The C/C++ CGI source code is in the SDK package.

                      Another way might be to wrap the CGI, e.g. call it from a PHP script, and do what filtering you want to do in the PHP script. People won't know the CGI script even exists on your site.

                      Comment


                      • #12
                        nOT TOO WORRIED ABOUT

                        The server getting bogged down.

                        It's just the fact that I would rather not give some one my whole DB on on 500 pages.

                        Granted it would only take a little longer to do searches of 10.

                        But it really comes down to a the fact that any one who know how to type *** into my site. Can.

                        1. In this world of "Traffic" to a site. Traffic is Extremely important. Especially for a site that is 6 months.

                        I would rather see 10 hits the 1. Too many thing revolve around "Page views" today.

                        I guess I need to look into the Wrapper via PHP.

                        How about ASPX? CAN it do what I need?



                        Also you guys have a good product. Why stop short on simply features that can be important to some. Why not allow users to make these changes,.


                        Regards

                        Comment


                        • #13
                          Still don't really see the purpose. Seems like you have 2 arguments.
                          1) Protecting your site. But Zoom is really only listing the content that is already on your site. If they want a content of your site there are dozens of tools available to download a copy of it. They don't need to use your search function to get a partial copy of small portions of it. So I don't see this as being a good reason. Forcing 10 results per page offers no protection.

                          2) Forcing people to view more pages on your site. Make them view lots of small pages rather than 1 large page to inflate your page view figures. So this might make sense if you are running adds on the site. But I am guessing that only 0.001% of people know how to directly manipulate the paramters in the URL. So you aren't going to get any additional traffic from this small number of people.

                          Why not allow users to make these changes
                          No one has asked for enforcement of the result count until now, and you can customise our source code if need be.

                          How about ASPX? CAN it do what I need?
                          Yes, There is example code for calling the CGI from .NET here.
                          http://www.wrensoft.com/zoom/support/aspdotnet.html

                          Comment


                          • #14
                            V7 will have a new feature that allows you to specify the maximum number of results to return for any search query (while V6 and earlier were all set to a maximum of 1000).

                            Funnily enough, this feature was added as custom development for a particular customer who actually wanted to request more than 1000, rather than less. So it's a very different reason than what you're asking about. But it would allow you to set it to as low as 10 if that's what you really want. But if you set it to 10 then you would only get 1 page of results, which isn't really what you are asking for.

                            We're still months away from a V7 release however (there's no set date yet). And I agree that it may not be as beneficial as you think it is.
                            --Ray
                            Wrensoft Web Software
                            Sydney, Australia
                            Zoom Search Engine

                            Comment

                            Working...
                            X