1

Topic: disabling the search function

Hi,

I would like to know if it is possible to totally disable the search function in punbb. If yes, how?

Thanks,

Ludo,

2

Re: disabling the search function

Delete search.php

Re: disabling the search function

I guess you could set every group so that it's not allowed to search.

Looking for a certain modification for your forum? Please take a look here before posting.

4 (edited by Ludo 2006-04-11 09:20)

Re: disabling the search function

Well, deleting the search.php file or setting groups with 'no search allowed' would indeed prevent users from making search. To my mind, just deleting the link 'search.php' would have effect.
But what I would like is more something like an option in punbb which would enable or not to use the search process (I mean the fact that for each post, keywords are put in the DB)
The option would disable keywords generation for each post and so it would avoid having big big DB....
Making that would not bloatify. It would in fact light the punbb forum tongue.

Ludo,

5 (edited by Smartys 2006-04-11 11:06)

Re: disabling the search function

Just comment the lines
update_search_index('post', $new_pid, $message);
in post.php
update_search_index('edit', $id, $message, $subject);
and
update_search_index('edit', $id, $message);
in edit.php
and that should stop indexing

http://fluxbb.org

Free PunBB Hosting - lots of mods, easy to customize

6 (edited by Ludo 2006-04-11 11:55)

Re: disabling the search function

when you say comment, you mean delete?
Then, how could I empty keywords without deleting the table in the whole (in the case I would like, later, to re-use the search function of punbb)
If it is so simple, I think we could easily have an option with the choice of using the search function of punbb or not. It would be a way to disable properly the search function.
that's just a suggestion but it could be a good thing for people who only want to use search with google and its adsense search wink

Ludo,

Re: disabling the search function

Commenting is embracing the code with /* */ or put // in front pf the code smile

And to clean, I forgot the command =/

Re: disabling the search function

Just set "Use search" to no for the user groups.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: disabling the search function

Rickard wrote:

Just set "Use search" to no for the user groups.

I said that already, and he already said no. tongue

Looking for a certain modification for your forum? Please take a look here before posting.

Re: disabling the search function

pogenwurst wrote:
Rickard wrote:

Just set "Use search" to no for the user groups.

I said that already, and he already said no. tongue

Sorry. I'm tired smile

"Programming is like sex: one mistake and you have to support it for the rest of your life."

11

Re: disabling the search function

pogenwurst wrote:

I said that already, and he already said no. tongue

Mmmmm. I did not really say no. I just said it would not empty the search index which is quite heavy in the db.
I don't want to be bloody annoying.
I just made suggestions. You can take it or not, it will not anoy me smile
To sum up for Rickard who is tired big_smile:
I would like one new feature : an option to totally disable the search function in punbb (empty the search index and delete the link search.php)

Ludo,

12 (edited by BlindMan 2006-04-26 17:20)

Re: disabling the search function

Would it be possible to make a basic search without the indexation tables, as you can do with other forums like phpBB?
I also have some database limitations, and having such big tables make me impossible to use PunBB.

Blacklisting words only reduced the tables of 1/3. sad

Any idea? smile

Re: disabling the search function

Would it be possible to make a basic search without the indexation tables, as you can do with other forums like phpBB?

PunBB's search feature is based on phpBB's tongue
And changing the search function to be the way you want it would be less efficent I believe, even if it does save DB space

http://fluxbb.org

Free PunBB Hosting - lots of mods, easy to customize

14 (edited by BlindMan 2006-04-27 07:06)

Re: disabling the search function

Yes, but with a 10MB database limitation, and no way to change of hoster, you have choices to make wink

15 (edited by Smartys 2006-04-27 10:40)

Re: disabling the search function

With a 10MB limitation you should probably move somewhere else tongue
Only very silly hosts limit databases that much (a lot simply count it against your disk quota or don't count it at all, which is better)
Plus, I doubt your forum can get very large even without the search tables. 10MB is small tongue

http://fluxbb.org

Free PunBB Hosting - lots of mods, easy to customize

16

Re: disabling the search function

i remowe serach link from functions.php and deselect "use search" from all groups ... edited show last post ... becouse i can't include serach.php to my site.. evrything seems to work cool

it's just me...

Re: disabling the search function

Smartys wrote:

With a 10MB limitation you should probably move somewhere else tongue
Only very silly hosts limit databases that much (a lot simply count it against your disk quota or don't count it at all, which is better)

I can't change this.

Smartys wrote:

Plus, I doubt your forum can get very large even without the search tables. 10MB is small tongue

With 2100 registred users (and guests allowed to post) this is not a *very* little forum. The problem is that I have to prune it and rebuild search index regulary.

Re: disabling the search function

I don't have any specific stats for PunBB, but here's some phpBB ones
http://www.phpbb.com/phpBB/viewtopic.php?t=48609
http://www.phpbb.com/phpBB/viewtopic.php?p=61823

So yeah, it depends a lot on where you have rows (ie: a row in posts is almost certainly larger than a row in users, and a longer post has a larger size). But IMO, 10MB is very small

And why can't you change it? There are plenty of hosts, free or otherwise, that at the VERY least give you more space for your databases than that

http://fluxbb.org

Free PunBB Hosting - lots of mods, easy to customize

19 (edited by BlindMan 2006-05-23 11:53)

Re: disabling the search function

In search.php I replaced this

                                                        // Are we searching for multibyte charset text?
                                                        if ($multibyte)
                                                        {
                                                                $cur_word = $db->escape('%'.str_replace('*', '', $cur_word).'%');
                                                                $cur_word_like = ($db_type == 'pgsql') ? 'ILIKE \''.$cur_word.'\'' : 'LIKE \''.$cur_word.'\'';

                                                                if ($search_in > 0)
                                                                        $sql = 'SELECT id FROM '.$db->prefix.'posts WHERE message '.$cur_word_like;
                                                                else if ($search_in < 0)
                                                                        $sql = 'SELECT p.id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id WHERE t.subject '.$cur_word_like.' GROUP BY p.id, t.id';
                                                                else
                                                                        $sql = 'SELECT p.id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id WHERE p.message '.$cur_word_like.' OR t.subject '.$cur_word_like.' GROUP BY p.id, t.id';
                                                        }
                                                        else
                                                        {
                                                                $cur_word = str_replace('*', '%', $cur_word);
                                                                $sql = 'SELECT m.post_id FROM '.$db->prefix.'search_words AS w INNER JOIN '.$db->prefix.'search_matches AS m ON m.word_id = w.id WHERE w.word LIKE \''.$cur_word.'\''.$search_in_cond;
                                                        }

By:

                                                        // Are we searching for multibyte charset text?
                                                        $cur_word = $db->escape('%'.str_replace('*', '', $cur_word).'%');
                                                        $cur_word_like = ($db_type == 'pgsql') ? 'ILIKE \''.$cur_word.'\'' : 'LIKE \''.$cur_word.'\'';

                                                        if ($search_in > 0)
                                                                $sql = 'SELECT id FROM '.$db->prefix.'posts WHERE message '.$cur_word_like;
                                                        else if ($search_in < 0)
                                                                $sql = 'SELECT p.id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id WHERE t.subject '.$cur_word_like.' GROUP BY p.id, t.id';
                                                        else
                                                                $sql = 'SELECT p.id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id WHERE p.message '.$cur_word_like.' OR t.subject '.$cur_word_like.' GROUP BY p.id, t.id';

(In fact I juste replaced "if ($multibyte)" by "if ($multibyte || 1)" to reduce code modifications, and be able to reverse this change easily.)

And I don't use anymore the indexation tables.
This is not a clean solution, and I know that it must be less efficient, or loads the server, but it works.

I also added a 'return;' at the beginning of the 'update_search_index' function, in the 'include/search_idx.php file, so the indexation tables are not fed anymore.