Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.1] Use real topic id #8332

Open
wants to merge 2 commits into
base: release-2.1
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Sources/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,9 @@ function PlushSearch2()
),
);

// Most searches are at the topic-level, and do not list message-level results.
// Message-level results are displayed when doing searches within topics
// and when showing complete results ("Show results as messages" option).
if (empty($search_params['topic']) && empty($search_params['show_complete']))
{
$main_query['select']['id_topic'] = 't.id_topic';
Expand All @@ -1317,6 +1320,7 @@ function PlushSearch2()
else
{
// This is outrageous!
// Note we're stuffing id_msg in an id_topic column to get past the db contraint.
$main_query['select']['id_topic'] = 'm.id_msg AS id_topic';
$main_query['select']['id_msg'] = 'm.id_msg';
$main_query['select']['num_matches'] = '1 AS num_matches';
Expand Down Expand Up @@ -1851,7 +1855,8 @@ function PlushSearch2()
$request = $smcFunc['db_search_query']('', '
SELECT ' . (empty($search_params['topic']) ? 'lsr.id_topic' : $search_params['topic'] . ' AS id_topic') . ', lsr.id_msg, lsr.relevance, lsr.num_matches
FROM {db_prefix}log_search_results AS lsr' . ($search_params['sort'] == 'num_replies' || !empty($approve_query) ? '
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = lsr.id_topic)' : '') . '
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = lsr.id_msg)
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)' : '') . '
WHERE lsr.id_search = {int:id_search}' . $approve_query . '
ORDER BY {raw:sort} {raw:sort_dir}
LIMIT {int:start}, {int:max}',
Expand Down
Loading