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

add_keyword_mappings()

Parameters

ColumnTypeDefaultDescription
$ref int
$string
$resource_type_field
$partial_index false
$is_date false
$optional_column ''
$optional_value ''
$is_html false

Location

include/resource_functions.php lines 2001 to 2034

Definition

 
function add_keyword_mappings(int $ref,$string,$resource_type_field,$partial_index=false,$is_date=false,$optional_column='',$optional_value='',$is_html=false)
    {
    
/* For each instance of a keyword in $string, add a keyword->resource mapping.
    * Create keywords that do not yet exist.
    * Increase the hit count of each keyword that matches.
    * Store the position and field the string was entered against for advanced searching.
    */
    
if(trim($string) == '')
        {
        return 
false;
        }

    
$keywords split_keywords($stringtrue$partial_index$is_date$is_html);
    
add_verbatim_keywords($keywords$string$resource_type_field); // add in any verbatim keywords (found using regex).

    
for($n 0$n count($keywords); $n++)
        {
        unset(
$kwpos);
        if(
is_array($keywords[$n]))
            {
            
$kwpos        $keywords[$n]['position'];
            
$keywords[$n] = $keywords[$n]['keyword'];
            }

        
$kw $keywords[$n];
        if(!isset(
$kwpos))
            {
            
$kwpos $n;
            }

        
add_keyword_to_resource($ref$kw$resource_type_field$kwpos$optional_column$optional_valuefalse);
        }

    }

This article was last updated 25th November 2020 08:05 Europe/London time based on the source file dated 13th November 2020 16:50 Europe/London time.