News:

Wondering if this will always be free?  See why free is better.

Main Menu

Limiting days in search

Started by Fizzy, September 16, 2004, 07:50:26 AM

Previous topic - Next topic

Fizzy

Please excuse the laymans terms here.

I am just about to upgrade over to SMF but thanks to a complaint and threat of being expelled by my server host about CPU usage I need to make sure that I reduce the amount of pressure the forum places on the server.
Now knowing SMF I am confident that the software itself would not cripple a server but one thing I am worried about is if I have picked up an enemy or two who are manually trying to give me a hard time by abusing the forum in a way that I cannot detect.
One area I thought might be responsible for my sudden high CPU peaks might be bad searching by guests or members (ie searching for * or the letter 'e' for the last 10,000 days)

What I need to do is to limit the CPU usage (something that I cannot measure or gauge) so I wondered if it's possible to do something with the search facility to stop dumb searches. In the DB we have fields "search_cache_size" and "search_max_cached_results" and was wondering if I change those figures would that help?

I don't know how the search facility operates- whether it gets all the data then reviews it or whether it reads concurrently and then stops once a certain search limit is reached.

Any suggestions gratefully received. I'm stressed and hacked off with my server host for not providing me with any data or solutions on this problem so I am literally on my own with only the help of you guys to get me through this. :)

[edit] changed topic title [/edit]
"Reality is merely an illusion, albeit a very persistent one." - A.E.


A.M.A

Really sorry .. real life is demanding my full attention .. will be back soon hopefully :)

Fizzy

Hi AMA,

Thanks for the links, but what I am really looking for is something to stop a dumb searcher from scrolling the whole database with every search.

Basically I would like search to start looking at the most recent posts and then when it hits a given number of posts it returns a "Sorry, your request cannot be continued"

Any ideas anyone?
"Reality is merely an illusion, albeit a very persistent one." - A.E.


Fizzy

Oh, not to worry.

I found this in search.php


// Maximum age of messages. Default to infinite (9999 days: param not set).
if (!empty($search_params['maxage']) || (!empty($_REQUEST['maxage']) && $_REQUEST['maxage'] != 9999))
$search_params['maxage'] = !empty($search_params['maxage']) ? (int) $search_params['maxage'] : (int) $_REQUEST['maxage'];


and in search.template.php I found


<td>
', $txt['search_between'], '&nbsp;<input type="text" name="minage" value="', empty($context['search_params']['minage']) ? '0' : $context['search_params']['minage'], '" size="5" maxlength="5" />&nbsp;', $txt['search_and'], '&nbsp;<input type="text" name="maxage" value="', empty($context['search_params']['maxage']) ? '9999' : $context['search_params']['maxage'], '" size="5" maxlength="5" /> ', $txt[579], '.


I just changed the "9999" to "60"
"Reality is merely an illusion, albeit a very persistent one." - A.E.


[Unknown]

Quote from: Fizzy on September 16, 2004, 07:07:42 PM
Oh, not to worry.

I found this in search.php


// Maximum age of messages. Default to infinite (9999 days: param not set).
if (!empty($search_params['maxage']) || (!empty($_REQUEST['maxage']) && $_REQUEST['maxage'] != 9999))
$search_params['maxage'] = !empty($search_params['maxage']) ? (int) $search_params['maxage'] : (int) $_REQUEST['maxage'];


and in search.template.php I found


<td>
', $txt['search_between'], '&nbsp;<input type="text" name="minage" value="', empty($context['search_params']['minage']) ? '0' : $context['search_params']['minage'], '" size="5" maxlength="5" />&nbsp;', $txt['search_and'], '&nbsp;<input type="text" name="maxage" value="', empty($context['search_params']['maxage']) ? '9999' : $context['search_params']['maxage'], '" size="5" maxlength="5" /> ', $txt[579], '.


I just changed the "9999" to "60"

Actually, if you change them both to 60, it won't change anything... you probably want:


// Maximum age of messages, no more than 60.
$search_params['maxage'] = min(!empty($search_params['maxage']) ? (int) $search_params['maxage'] : (int) $_REQUEST['maxage'], 60);


And:


<td>
', $txt['search_between'], '&nbsp;<input type="text" name="minage" value="', empty($context['search_params']['minage']) ? '0' : $context['search_params']['minage'], '" size="5" maxlength="2" />&nbsp;', $txt['search_and'], '&nbsp;<input type="text" name="maxage" value="', empty($context['search_params']['maxage']) ? '60' : $context['search_params']['maxage'], '" size="5" maxlength="2" /> ', $txt[579], '.


This will make the max days 60.

-[Unknown]

Fizzy

Ahh, let me guess ....

The changes I proposed might of changed the figure that automaticly appeared in the search screen but woudln't of made a blind bit of differnce to how the search was carried out?

* Fizzy smacks himself with a herring  >:(


[Unknown] Thanks for taking the time to help me out. You are one smart cookie  8)
"Reality is merely an illusion, albeit a very persistent one." - A.E.


Ben_S

Liverpool FC Forum with 14 million+ posts.

[Unknown]

Quote from: Fizzy on September 17, 2004, 07:38:42 PM
The changes I proposed might of changed the figure that automaticly appeared in the search screen but woudln't of made a blind bit of differnce to how the search was carried out?

Well... uuhh, yeah basically.  Or, if they typed 9999 it would actually limit it to that many days....

And I'm not a session or a cookie, I'm a cache!

-[Unknown]

Fizzy

"Reality is merely an illusion, albeit a very persistent one." - A.E.


Advertisement: