Collections functions
General functions
Node functions
Render functions
Theme permission functions
User 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=ps_value("SELECT keyword value FROM keyword WHERE soundex = ? AND keyword NOT LIKE '% %' AND hit_count > ? ORDER BY hit_count DESC LIMIT 1",["s",soundex($keyword),"i",$soundex_suggest_limit],false);
    if ((
$soundex===false) && (strlen($keyword)>=4))
        {
        
# No soundex match, suggest words that start with the same first few letters.
        
return ps_value("SELECT keyword value FROM keyword WHERE keyword LIKE ? AND keyword NOT LIKE '% %' ORDER BY hit_count DESC LIMIT 1",["s",substr($keyword,0,4) . "%"],0);
        }
    return 
$soundex;
    }

This article was last updated 19th March 2024 05:35 Europe/London time based on the source file dated 15th March 2024 17:00 Europe/London time.