[2.0 RC3] Redirection boards appear in the search dialogue

Started by Arantor, May 13, 2010, 08:37:09 AM

Previous topic - Next topic

Arantor

Redirection boards appear in the list of boards you can search through, except that they contain no topics and so will never find anything anyway.

It's not so much they shouldn't be included in the search, they shouldn't even be displayed. In fact, I'd even argue that for the purposes of the search itself you shouldn't filter on it, because the natural process of inner joins will likely deal with that better.

However, the performance hit is not as much an issue when you're just doing what is otherwise a straight table scan in this query in Search.php

$request = $smcFunc['db_query']('order_by_board_order', '
SELECT b.id_cat, c.name AS cat_name, b.id_board, b.name, b.child_level
FROM {db_prefix}boards AS b
LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)
WHERE {query_see_board}',
array(
)
);


All it needs to become to hide the redirect boards:
$request = $smcFunc['db_query']('order_by_board_order', '
SELECT b.id_cat, c.name AS cat_name, b.id_board, b.name, b.child_level
FROM {db_prefix}boards AS b
LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)
WHERE {query_see_board}
AND b.redirect = {string:blank_string}',
array(
'blank_string' => '',
)
);

Norv

Thank you for the report, and for sharing your solution!
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

Arantor

Bah, my bad. There's a typo in the above, should be = not != {string:blank_string}

Anyway, you're more than welcome :)

[SiNaN]

Former SMF Core Developer | My Mods | SimplePortal

[SiNaN]

Former SMF Core Developer | My Mods | SimplePortal

MultiformeIngegno

RockCiclopedia (wiki - forum), Tutta la storia del rock, scritta da voi ...
Rimanere aggiornati sul mondo della musica grazie al nuovo feed "RockCiclopedia Music News"!

Advertisement: