Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test 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 2092 to 2125

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 28th June 2022 15:05 Europe/London time based on the source file dated 27th June 2022 12:50 Europe/London time.