Member auto suggest limit

Started by asmith, September 13, 2021, 01:48:37 PM

Previous topic - Next topic

asmith

File Subs-Editor.php
function AutoSuggest_Search_Member()

// Find the member.
$request = $smcFunc['db_query']('', '
SELECT id_member, real_name
FROM {db_prefix}members
WHERE {raw:real_name} LIKE {string:search}' . (!empty($context['search_param']['buddies']) ? '
AND id_member IN ({array_int:buddy_list})' : '') . '
AND is_activated IN (1, 11)
LIMIT ' . ($smcFunc['strlen']($_REQUEST['search']) <= 2 ? '100' : '800'),
array(
'real_name' => $smcFunc['db_case_sensitive'] ? 'LOWER(real_name)' : 'real_name',
'buddy_list' => $user_info['buddies'],
'search' => $_REQUEST['search'],
)
);

The limit values is 100 for search keywords less than 3 and 800 for more.
It's been like that in SMF 2.0 as well.

It is for an autosuggest field and 10-20 results would suffice. What's the reason for such high numbers?

Arantor

Is it actually problematic for you to have the numbers like that?

It's mostly targeted at *large* sites, like this one, where even 100 might not be enough to actually find the results you want.
Holder of controversial views, all of which my own.


asmith

I don't have a forum as big as this one so I don't know. On my own forums, I've never had any problems.

I was just curious about those numbers. The number 800 just looks random and awfully high :)

Arantor

It's not been a problem even on this forum to have it that large... and the numbers have been set in place for about 14 years at this point...
Holder of controversial views, all of which my own.


Advertisement: