PDA

View Full Version : Sphinx and soft deletes


LauraS
12-08-2008, 08:08 PM
I'm having an issue with sphinx search when finding posts by a user. I have a thread that was marked as a soft delete (thread.visible = 2) but the posts inside that thread were not soft deleted (post.visible = 1). The problem I'm seeing is that if I then run a find post by user search those soft deleted posts don't show up in the output even though in the DB I can see that that postid is set to visible = 1. So I'm not really seeing ALL the posts for that user. Anybody experienced something like this?

Danny

LauraS
12-09-2008, 08:59 PM
I think i found the solution to my problem. Seemed like for super mod, mod and admin account types soft deletes would still display using vbsearch when doing find post/thread by users but since sphinx does not index soft deletes they'd never show up on the output when converted to sphinx search. To remedy that I modified search_sphinx.php with the following:

near the top after


// admin only mode
#if ($vbulletin->userinfo['userid'] != 1) die('Search not available at the moment.');

// finduser
if ($_REQUEST['do'] == 'finduser')
{


I included


// My code ************************************************** *****
// Don't do sphinx search for admins, mods and super mods
if ($vbulletin->userinfo['usergroupid'] == 5 || $vbulletin->userinfo['usergroupid'] == 6 || $vbulletin->userinfo['usergroupid'] == 7) {
return true;
}

// Checking to see if user is member of admin, mod, super mods
$ccGroupList = explode(",", $vbulletin->userinfo['membergroupids']);
foreach($ccGroupList as $ccGroupID) {
if ($ccGroupID == 5 || $ccGroupID == 6 || $ccGroupID == 7) {
return true;
}
}
// End of my code ************************************************** *

// search timer
$searchstart = microtime();


Basically when either the usergroupid or membergroupids is or part of admin, mod, super mod accounts it exits out and uses normal vbsearch which for us is not a huge deal and seems to work.

Danny