Collections functions
General functions
Render functions
Theme permission functions
User functions
Resource functions

get_related_keywords()

Parameters

ColumnTypeDefaultDescription
$keyref

Location

include/search_functions.php lines 2578 to 2599

Definition

 
function get_related_keywords($keyref)
    {
    
debug_function_call("get_related_keywords"func_get_args());

    
# For a given keyword reference returns the related keywords
    # Also reverses the process, returning keywords for matching related words
    # and for matching related words, also returns other words related to the same keyword.
    
global $keyword_relationships_one_way;
    global 
$related_keywords_cache;
    if (isset(
$related_keywords_cache[$keyref])){
        return 
$related_keywords_cache[$keyref];
    } else {
        if (
$keyword_relationships_one_way){
            
$related_keywords_cache[$keyref]=ps_array("select related value from keyword_related where keyword=?",array("i",$keyref));
            return 
$related_keywords_cache[$keyref];
            }
        else {
            
$related_keywords_cache[$keyref]=ps_array("select keyword value from keyword_related where related=? union select related value from keyword_related where (keyword=? or keyword in (select keyword value from keyword_related where related=?)) and related<>?",array("i",$keyref,"i",$keyref,"i",$keyref,"i",$keyref));
            return 
$related_keywords_cache[$keyref];
            }
        }
    }

This article was last updated 29th November 2023 21:05 Europe/London time based on the source file dated 13th November 2023 11:05 Europe/London time.