Source for file token.php
Documentation is available at token.php
* @package Joomla.Administrator
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* Token class for the Finder indexer package.
* @package Joomla.Administrator
* This is the term that will be referenced in the terms table and the
* The stem is used to match the root term and produce more potential
* matches when searching the index.
* If the token is numeric, it is likely to be short and uncommon so the
* weight is adjusted to compensate for that situation.
* If the token is a common term, the weight is adjusted to compensate for
* the higher frequency of the term in relation to other terms.
* Flag for phrase tokens.
* The length is used to calculate the weight of the token.
* The weight is calculated based on token size and whether the token is
* considered a common term.
* The simple language identifier for the token.
* Method to construct the token object.
* @param mixed $term The term as a string for words or an array for phrases.
* @param string $lang The simple language identifier.
* @param string $spacer The space separator for phrases. [optional]
public function __construct($term, $lang, $spacer =
' ')
// Tokens can be a single word or an array of words representing a phrase.
// Populate the token instance.
$this->stem =
implode($spacer, array_map(array('FinderIndexerHelper', 'stem'), $term, array($lang)));
* Calculate the weight of the token.
* 1. Length of the token up to 30 and divide by 30, add 1.
* 2. Round weight to 4 decimal points.
// Populate the token instance.
* Calculate the weight of the token.
* 1. Length of the token up to 15 and divide by 15.
* 2. If common term, divide weight by 8.
* 3. If numeric, multiply weight by 1.5.
* 4. Round weight to 4 decimal points.
Documentation generated on Tue, 19 Nov 2013 15:15:48 +0100 by phpDocumentor 1.4.3