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.
Announcement
Collapse
No announcement yet.
limit the results per page
Collapse
X
-
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.
-
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
-
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...
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
-
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
-
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
-
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
-
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?
Comment
-
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
-
I can not have user with tha ability to inject 999 as the results per page value
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
-
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
-
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
How about ASPX? CAN it do what I need?
http://www.wrensoft.com/zoom/support/aspdotnet.html
Comment
-
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.
Comment
Comment