philg_keywords_score keywords string_to_searchWhat it does:
Takes space-separated keywords and returns 0 if none are found or a count of how many matched. If a keyword occurs twice then it is weighted 2.Defined in: /web/philip/packages/acs-core/utilities-procs.tcl
Source code:
# turn keywords into space-separated things # replace one or more commads with a space regsub -all {,+} $keywords " " keywords_no_commas set keyword_list [split $keywords_no_commas " "] set score 0 foreach word $keyword_list { # turns out that "" is never found in a search, so we # don't really have to special case $word == "" if { $word != "" && [string first [string toupper $word] [string toupper $string_to_search]] != -1 } { # found at least one! if { [string first [string toupper $word] [string toupper $string_to_search]] == [string last [string toupper $word] [string toupper $string_to_search]] } { # only one occurrence incr score } else { # more than one, count as 2 (like AltaVista) incr score 2 } } } return $score