Collections functions
General functions
Render functions
Theme permission 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 4th October 2022 10:05 Europe/London time based on the source file dated 3rd October 2022 17:20 Europe/London time.