MyBB Community Forums

Full Version: How to Make Exact Search the default
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Wow it works perfectly! Thank you so much!

The only other problem I have with searching is I can't put more than 250 characters in the extended search box.

Do you know how I can input more than 250 characters in the extended search box?
I can't find a setting for that. Do you get an error message with longer search strings?
I don't get an error message but it just won't let me type any more characters than 250

Like try copying and pasting this into the extended search box:

ThisIsReallyLongThisIsReallyLongThisIsReallyLongThisIsReallyLongThisIsReallyLongThisIsReallyLongThisIsReallyLongThisIsReallyLongThisIsReallyLongThisIsReallyLongThisIsReallyLongThisIsReallyLongThisIsReallyLongThisIsReallyLongThisIsReallyLongThisIsReallylong

It cuts off at 250 characters so it ends up looking like this:

ThisIsReallyLongThisIsReallyLongThisIsReallyLongThisIsReallyLongThisIsReallyLong​ThisIsReallyLongThisIsReallyLongThisIsReallyLongThisIsReallyLongThisIsReallyLong​ThisIsReallyLongThisIsReallyLongThisIsReallyLongThisIsReallyLongThisIsReallyLong​ThisIsR

this problem might be off topic so I might post a new thread for this problem if nobody can figure this out.
I will look at it, wait for a moment.
Thanks again man.
How long to you want to have it?
Perhaps I can change it in the same plugin. Smile
Can you make it unlimited like the quick search box?

I'm testing the quick search box and it looks like it can take more than 250 characters.
I think this is possible, give me some more time.
Ok. Thanks.
Can you try this one:
<?php
/**
 * Disallow direct access to this file for security reasons
 * 
 */
if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
} 
$plugins->add_hook("search_do_search_start", "search_exact");
/**
 * Standard MyBB info function
 * 
 */
function search_exact_info()
{
    global $lang;
    return Array(
        'name'          => "search_exact",
        'description'   => "search with keywords placed within quotes (exact search)", 
        'website'       => '',
        'author'        => 'Ad Bakker',
        'authorsite'    => '',
        'version'       => '1.0',
        'guid'          => '',
        'compatibility' => '18*',
    );
}

function search_exact_activate()
{
    require_once(MYBB_ROOT . '/inc/adminfunctions_templates.php');
	find_replace_templatesets('search', '#' . preg_quote('size="35" maxlength="250"') . '#','size="35"');	
}

function search_exact_deactivate()
{
    require_once(MYBB_ROOT . '/inc/adminfunctions_templates.php');
	find_replace_templatesets('search', '#' . preg_quote('size="35"') . '#','size="35" maxlength="250"');;
}

function search_exact()
{
	global $mybb, $templates;
	$mybb->input['keywords'] = "\"{$mybb->input['keywords']}\"";
}
?>

I wonder whether it will work. Smile
Pages: 1 2 3