Page 1 of 1

Disable Search Indexing

Posted: Sat Sep 02, 2006 4:25 pm
by Extensions Robot
MOD Name: Disable Search Indexing
Author: albosky
MOD Description: Enables administrators to selectively turn off posts from being indexed in the search tables on a per forum basis. Indexing will be adjusted accordingly when posts are moved between forums that have indexing enabled or disabled.

MOD Version: 1.0.0
Tested on phpBB Version: 2.0.21

Download File: disable_indexing-1.zip
mods overview page: View
File Size: 24638 Bytes



Support for this MOD needs to be asked within this topic. The phpBB Teams are not responsible or required to give anyone support for this MOD. By installing this MOD, the phpBB Support Team or phpBB MODifications Team may not be able to provide support.

This MOD has only been tested by the phpBB MOD Team with the phpBB version listed in the topic. It may not work in any other versions of phpBB.

Posted: Tue Sep 19, 2006 3:33 pm
by TerraFrost
MOD Validated/Released

Notes:

Posted: Tue Sep 19, 2006 4:32 pm
by albosky
Thanks to the MOD team for validating this :)

Just a note I would like to add that if this is installed to an existing forum , it will not make any changes to existing posts , until they are moved , or edited.

Posted: Tue Nov 21, 2006 7:32 pm
by joebert
Awesome !

I had to add one tiny thing though.
Keeps the disabled forums & categories (when no forums are available for the category) from showing up in the list on the search page.

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
search.php
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT c.cat_title, c.cat_id, f.forum_name, f.forum_id
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, f.index_posts
#
#-----[ FIND ]------------------------------------------
#
	if ( $is_auth_ary[$row['forum_id']]['auth_read']
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
 &&($row['index_posts'] == 1)

Re: Disable Search Indexing

Posted: Mon Mar 31, 2008 6:27 pm
by Dogs and things
Very nice MOD indeed,

It keeps my search tables nicely empty. ;)

Allthough maybe a bit late, thanks a lot for writing it, it´s a very handy MOD for my board.

Re: Disable Search Indexing

Posted: Tue Oct 28, 2008 7:47 pm
by stevemagruder
I just discovered a major bug in this mod that is amazing to me, as validation nor any user of the mod has caught it to date.

Here's the fix you can apply:

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
modcp.php
#
#-----[ FIND ]------------------------------------------
#
          while ( $row2 = $db->sql_fetchrow($result) )
#
#-----[ BEFORE, ADD ]------------------------------------------
#
          $sql = "SELECT *
            FROM " . POSTS_TABLE . "
            WHERE topic_id = $topic_id";
          if ( !($result = $db->sql_query($sql)) )
          {
            message_die(GENERAL_ERROR, 'Could not select from posts table', '', __LINE__, __FILE__, $sql);
          }
The $result variable in the while statement was referring to a previous SQL result that had been freed, and what's worse, there was no subsequent executed SQL that pulled the posts from the topic, as would be expected if you are referring to all the post_id fields from the topic's posts in the while section.

Re: Disable Search Indexing

Posted: Tue Oct 28, 2008 9:17 pm
by stevemagruder
And here's a fix for yet another bug in this mod:

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
modcp.php
#
#-----[ FIND ]------------------------------------------
#
            if ((!$index_post) && (index_posts))
#
#-----[ REPLACE WITH ]------------------------------------------
#
            if ((!$index_post) && ($index_posts))
This code tests to see if the forum the topic was in wasn't indexed, and if the forum it's moving to is indexed.

Re: Disable Search Indexing

Posted: Tue Oct 28, 2008 9:21 pm
by stevemagruder
I would advise everyone using this mod to apply the last two fixes, and then rebuild your search indexes using the mod Rebuild Search.

Make sure you make Rebuild Search compatible with Disable Search Indexing first, as follows:

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
admin_rebuild_search.php
#
#-----[ FIND ]------------------------------------------
#
	// get the post subject/text of each post
	$sql = "SELECT post_id, post_subject, post_text
		FROM " . POSTS_TEXT_TABLE . "
			WHERE post_id >= $start
			ORDER BY post_id ASC
			LIMIT $post_limit";
#
#-----[ REPLACE WITH ]------------------------------------------
#
	// get the post subject/text of each post
	$sql = "SELECT t.post_id, t.post_subject, t.post_text
		FROM " . POSTS_TEXT_TABLE . " t, " . POSTS_TABLE . " p, " . FORUMS_TABLE . " f 
			WHERE t.post_id >= $start
	          AND t.post_id = p.post_id
	          AND p.forum_id = f.forum_id
	          AND f.index_posts = 1
			ORDER BY t.post_id ASC
			LIMIT $post_limit";