Topic: Limit search results

$result = $db->query('SELECT t.id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id IN('.implode(',', $search_ids).')'.$forum_sql.' GROUP BY t.id', true) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());

(...)

$result = $db->query('SELECT p.id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id IN('.implode(',', $search_ids).')'.$forum_sql, true) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());

These two queries around 290-310 in search.php can be quite heavy when the search returns alot of posts.

I suggest adding a feature to the admin to limit the number of results and leaving a message telling the user that not all the results are shown. It's only a matter of chopping off some IDs from $search_ids. Shouldn't be too difficult to implement, but maybe something is needed for the thread view, so you don't end up with one thread containing 30 posts which all contain the search words wink

I know there is the "Search all forums" block but personally, I don't like that at all. It would be a pain to search through for example 10 forums. I would just make a new thread asking for the information instead.

Re: Limit search results

didn't GUI do something like this for the macaddict forums? i recall he was having issues with the search function on his forums. i think it would benefit large forums since a search could bring the server to it's knees it seems.

~James
FluxBB - Less is more

Re: Limit search results

Yeah, and I think very few people are actually looking through much of a 100+ search result. You probably just go back and make it more specific.