/** * @param integer $maxDocs the number of docs in the index * @param float[]|null $boostTemplates Array of key values, key is the template name, value the boost factor. * Defaults to Util::getDefaultBoostTemplates() */ public function __construct($maxDocs, $boostTemplates = null) { $this->maxDocs = $maxDocs; $this->boostTemplates = $boostTemplates ?: Util::getDefaultBoostTemplates(); // We normalize incoming links according to the size of the index $this->incomingLinksNorm = (int) ($maxDocs * self::INCOMING_LINKS_MAX_DOCS_FACTOR); if ($this->incomingLinksNorm < 1) { // it's a very small wiki let's force the norm to 1 $this->incomingLinksNorm = 1; } }
/** * @param SearchContext $context * @param float $weight */ public function __construct(SearchContext $context, $weight) { parent::__construct($context, $weight); // Use the boosted template from query string if available $this->boostTemplates = $context->getBoostTemplatesFromQuery(); // empty array may be returned here in the case of a syntax error // @todo: verify that this is what we want: in case of a syntax error // we disable default boost templates. if ($this->boostTemplates === null) { // Fallback to default otherwize $this->boostTemplates = Util::getDefaultBoostTemplates(); } }