continue;
}
$pid = $key['pid'];
- $toks = preg_split('/[ \'\-]+/', strtolower(replace_accent($key['name'])),
- -1, PREG_SPLIT_NO_EMPTY);
+ require_once 'name.func.inc.php';
+ $toks = split_name_for_search($key['name']);
$toks = array_reverse($toks);
/* Split the score between the tokens to avoid the user to be over-rated.
return $sn_old;
}
+/** Splits a name into tokens, as used in search_name.
+ * Used for search_name rebuilding and for queries.
+ */
+function split_name_for_search($name) {
+ return preg_split('/[[:space:]\'\-]+/', strtolower(replace_accent($name)),
+ -1, PREG_SPLIT_NO_EMPTY);
+}
+
/** Transform a name to its canonical value so it can be compared
* to another form (different case, with accents or with - instead
* of blanks).
return false;
}
- $this->val = preg_split('/[[:space:]]/', $this->val);
+ require_once 'name.func.inc.php';
+
+ $this->val = split_name_for_search($this->val);
if (count($this->val) == 0) {
$this->empty = true;
}