I did some digging to try to get to the bottom of this. These files are from XenForo 1.2.0.
First of all, in /library/XenForo/DataWriter/Discussion.php, at line 611 is the protected function _indexForSearch(). Here's the block of code:
[PHP] /**
* Updates the search index for this discussion.
*/
protected function _indexForSearch()
{
if ($this->get('discussion_state') == 'visible')
{
if ($this->getExisting('discussion_state') != 'visible')
{
$this->_insertIntoSearchIndex();
}
else if ($this->_needsSearchIndexUpdate())
{
$this->_updateSearchIndexTitle();
}
}
else if ($this->isUpdate() && $this->get('discussion_state') != 'visible' && $this->getExisting('discussion_state') == 'visible')
{
$this->_deleteFromSearchIndex();
}
}
[/PHP]
And in library/XenForo/DataWriter/DiscussionMessage.php, line 730, the same function:
[PHP] /**
* Updates the search index for this message.
*/
protected function _indexForSearch()
{
if ($this->get('message_state') == 'visible')
{
if ($this->getExisting('message_state') != 'visible' || $this->isChanged('message'))
{
$this->_insertOrUpdateSearchIndex();
}
}
else if ($this->isUpdate() && $this->get('message_state') != 'visible' && $this->getExisting('message_state') == 'visible')
{
$this->_deleteFromSearchIndex();
}
}
[/PHP]
I'm mentally exhausted as I type this (programming logic eludes me at the moment
), but would it be as simple as getting rid of both "else if" statements? Or, could we cleanly do away with anything having to do with message_state != 'visible' or == 'visible'?
In order to make all of the soft-deleted messages appear in search, then, would I need to rebuild the search indexes? It makes me wonder if I would have to modify something else in order to get the forum to rebuild the indexes but with the soft-deleted threads and posts intact.
My only concern after these edits: if we decide to keep these soft-deleted posts/threads in the index, will forum permissions prevent these from appearing for non-staff members? I am thinking they'll be OK, but wanted to check...