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

remove_node_keyword()

Description

Removes node keyword for indexing purposes

Parameters

ColumnTypeDefaultDescription
$node integer ID of the node (from node table) the keyword should be linked to
$keyword string Keyword to index
$position integer The position of the keyword in the string that was indexed
$normalized boolean false If this keyword is normalized by the time we add it, set as true

Return

void

Location

include/node_functions.php lines 970 to 1002

Definition

 
function remove_node_keyword($node$keyword$position$normalized false)
    {
    global 
$unnormalized_index$noadd;

    if(!
$normalized)
        {
        
$original_keyword $keyword;
        
$keyword          normalize_keyword($keyword);

        
// if $keyword has changed after normalizing it, then remove the original value as well
        
if($keyword != $original_keyword && $unnormalized_index)
            {
            
remove_node_keyword($node$original_keyword$positiontrue);
            }
        }

    
$keyword_ref resolve_keyword($keywordtrue);

    
$position_sql '';
    if(
'' != trim($position))
        {
        
$position_sql " AND position = '" escape_check($position) . "'";
        }

    
sql_query("DELETE FROM node_keyword WHERE node = '" escape_check($node) . "' AND keyword = '" escape_check($keyword_ref) . "' $position_sql");
    
sql_query("UPDATE keyword SET hit_count = hit_count - 1 WHERE ref = '" escape_check($keyword_ref) . "'");

    
log_activity("Keyword ID {$keyword_ref} removed for node ID #{$node}"LOG_CODE_DELETEDnull'node_keyword'nullnullnull$keyword);

    
clear_query_cache("schema");

    return;
    }

This article was last updated 1st December 2020 09:05 Europe/London time based on the source file dated 30th November 2020 09:45 Europe/London time.