Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

resolve_soundex()

Parameters

ColumnTypeDefaultDescription
$keyword

Location

include/search_functions.php lines 6 to 19

Definition

 
function resolve_soundex($keyword)
    {
    
# returns the most commonly used keyword that sounds like $keyword, or failing a soundex match,
    # the most commonly used keyword that starts with the same few letters.

    
global $soundex_suggest_limit;
    
$soundex=sql_value("SELECT keyword value FROM keyword WHERE soundex='"escape_check(soundex($keyword))."' AND keyword NOT LIKE '% %' AND hit_count>'" $soundex_suggest_limit "' ORDER BY hit_count DESC LIMIT 1",false);
    if ((
$soundex===false) && (strlen($keyword)>=4))
        {
        
# No soundex match, suggest words that start with the same first few letters.
        
return sql_value("SELECT keyword value FROM keyword WHERE keyword LIKE '" escape_check(substr($keyword,0,4)) . "%' AND keyword NOT LIKE '% %' ORDER BY hit_count DESC LIMIT 1",false);
        }
    return 
$soundex;
    }

This article was last updated 24th November 2020 20:05 Europe/London time based on the source file dated 19th November 2020 14:20 Europe/London time.