Assigns the query normalization factor to this.

@param float $queryNorm
15832
public function normalize($queryNorm)
    {
        // incorporate boost
        $queryNorm *= $this->_query->getBoost();

        foreach ($this->_weights as $weight) {
            $weight->normalize($queryNorm);
        }
    }
1159897
@Override
    public <T> Query setParameter(Parameter<T> paramParameter, T paramT)
    {
        if (!getParameters().contains(paramParameter))
        {
            throw new IllegalArgumentException("parameter does not correspond to a parameter of the query");
        }

        if (paramParameter.getName() != null)
        {
            kunderaQuery.setParameter(paramParameter.getName(), paramT);
        }
        else
        {
            kunderaQuery.setParameter(paramParameter.getPosition(), paramT);
        }

        return this;
    }
64374
public void add(T queryParameter) {
		Assert.notNull(queryParameter, "QueryParameter must not be null!");
		this.parameters.put(queryParameter.getName(), queryParameter);
	}
226564
public function normalizeNodeQuery(NodeQuery $nodeQuery)
    {
        if($nodeQuery->getParameter('NodeQuery.normalized') == null)
        {
            $this->Events->trigger('Node.normalizeQuery', $nodeQuery);
            $nodeQuery->setParameter('NodeQuery.normalized', true);
        }

//
//        if($nodeQuery->hasParameter('NodePartials.eq') && $nodeQuery->hasParameter('NodeRefs.normalized') && $nodeQuery->hasParameter('NodeRefs.fullyQualified'))
//            return $nodeQuery;


        if(!$nodeQuery->hasParameter('NodePartials.eq'))
            $nodeQuery->setParameter('NodePartials.eq', new NodePartials($nodeQuery->getParameter('Meta.select'), $nodeQuery->getParameter('OutTags.select'), $nodeQuery->getParameter('InTags.select')));

        // NODEREFS
        if($nodeQuery->hasParameter('NodeRefs.in'))
        {
            $noderefsin = $nodeQuery->getParameter('NodeRefs.in');

            if(is_string($noderefsin)) {
                $nodeRefsIn = array();

                $noderefsin = explode(',',$noderefsin);
                foreach($noderefsin as $noderefstr)
                {
                    $noderef = $this->parseFromString(trim($noderefstr));
                    if(!empty($noderef))
                        $nodeRefsIn[] = $noderef;
                }

            } else {
                $nodeRefsIn = $noderefsin;

            }

            $nodeQuery->setParameter('NodeRefs.normalized', $nodeRefsIn);

            if(!$nodeQuery->hasParameter('NodeRefs.fullyQualified'))
                $nodeQuery->setParameter('NodeRefs.fullyQualified', true);

            return $nodeQuery;
//            return array($nodeRefsIn, $nodePartials,
//                $nodeQuery->hasParameter('NodeRefs.fullyQualified')?$nodeQuery->getParameter('NodeRefs.fullyQualified'):true);

        }



        $nodeRefs = array();

        if(!$nodeQuery->hasParameter('Elements.in'))
            throw new NodeException('Unable to query nodes without Elements.in specified');

        $elementSlugs = $nodeQuery->getParameter('Elements.in');
        if(!is_array($elementSlugs))
            $elementSlugs = StringUtils::smartExplode($elementSlugs);

//        $firstElement = null;

        $sites = array();

        if($nodeQuery->hasParameter('Sites.in')) {
            $siteSlugs = $nodeQuery->getParameter('Sites.in');
            if(!is_array($siteSlugs))
                $siteSlugs = StringUtils::smartExplode($siteSlugs);

            $sites = $this->SiteService->multiGetBySlug($siteSlugs);
        }

        $elements = array();
        foreach($elementSlugs as $ek => $elementSlug)
        {
            if(substr($elementSlug, 0, 1) == '@'){

                $aspectSlug = substr($elementSlug, 1);
                $aspect = $this->AspectService->getBySlug($aspectSlug);

                if($aspect->ElementMode == 'one' || $aspect->ElementMode == 'anchored')
                {

                    $elements = array_merge($elements, (array)$this->ElementService->findAllWithAspect($aspectSlug));
                    unset($elementSlugs[$ek]);

                } else {

                    if(!empty($sites))
                        foreach((array)$sites as $site)
                            $elements = array_merge($elements, (array)$this->ElementService->findAllWithAspect($aspectSlug, $site->getSlug()));
                    else
                        $elements = array_merge($elements, (array)$this->ElementService->findAllWithAspect($aspectSlug));

                }
            } else {

                $elements[] = $this->ElementService->getBySlug($elementSlug);
            }

        }

        if(empty($elements))
            throw new NoElementsException('No elements found for expression ['.$nodeQuery->getParameter('Elements.in').'].');


        $allFullyQualified = false;

//        $allSites = array();
//        if($nodeQuery->hasParameter('Sites.in')) {
//            $siteSlugs = $nodeQuery->getParameter('Sites.in');
//            if(!is_array($siteSlugs))
//                $siteSlugs = StringUtils::smartExplode($siteSlugs);
//
//            $allSites = $this->SiteService->multiGetBySlug($siteSlugs);
//        } else if ($nodeQuery->hasParameter('SiteIDs.in')) {
//            $siteIDs = $nodeQuery->getParameter('SiteIDs.in');
//            if(!is_array($siteIDs))
//                $siteIDs = StringUtils::smartExplode($siteIDs);
//
//            foreach($siteIDs as $siteID)
//                $allSites[] = $this->SiteService->getByID($siteID);
//
//        } else {
//            $allSites = $this->SiteService->findAll()->getResults();
//        }


        foreach($elements as $element)
        {

//            if($element->isAnchored() && $nodeQuery->getParameter('Elements.ignoreAnchoredSite') == null){
//                $sites = array($element->getAnchoredSite());
//            } else {
//                $sites = $allSites;
//            }

//            foreach($sites as $site)
//            {
                if (($slugs = $nodeQuery->getParameter('Slugs.in')) != null) {
                    if(!is_array($slugs))
                        $slugs = StringUtils::smartExplode($slugs);

                    $allFullyQualified = true;
                    foreach($slugs as $slug)
                        $nodeRefs[] = new NodeRef($element, SlugUtils::createSlug($slug, true));
                }else {
                    $nodeRefs[] = new NodeRef($element);
                }
//            }
        }


        $nodeQuery->setParameter('NodeRefs.normalized', $nodeRefs);

        //if(!$nodeQuery->hasParameter('NodeRefs.fullyQualified'))
        $nodeQuery->setParameter('NodeRefs.fullyQualified', $allFullyQualified);
        //return array($nodeRefs, $nodePartials, $allFullyQualified);
        return $nodeQuery;

    }
80245
private function prepareConstant($parameter)
    {
        if (!$this->uriParser->hasQueryParameter($parameter)) {
            return;
        }

        $callback = [$this, $this->setterMethodName($parameter)];
        $callbackParameter = $this->uriParser->queryParameter($parameter);

        call_user_func($callback, $callbackParameter['value']);
    }
858823
public function setNormalMinimum($normalMinimum)
    {
        if (is_numeric($normalMinimum) || (is_bool($normalMinimum) && $normalMinimum === false)) {
            $this->normalMinimum = $normalMinimum;
        } else {
            $msg = "NormalMinimum must be a number or (boolean) false, '" . gettype($normalMinimum) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
238213
public function getResultsForToken($token, $queryNorm)
    {
        $db = $this->getSearchDbHandle();
        $contentDbPath = $this->storageDir . DIRECTORY_SEPARATOR . 'content.db';
        $db->exec('ATTACH ' . $db->quote($contentDbPath) . ' as `content_db`;');
        $sql = '
			SELECT (:queryNorm * 
						(SUM(term_frequency.frequency) --TF
						* inverse_document_frequency.inverseDocumentFrequency -- IDF
						* SUM(term_frequency.termNorm) -- norm
						) 
				    )AS score,
				   SUM(term_frequency.frequency) AS TF,
				   inverse_document_frequency.inverseDocumentFrequency AS IDF,
				   SUM(term_frequency.termNorm) AS norm,
				   term_frequency.documentPath
			  FROM term_frequency
		 LEFT JOIN inverse_document_frequency
		 		ON inverse_document_frequency.term = term_frequency.term
		 LEFT JOIN documents_published
		        ON documents_published.path = term_frequency.documentPath
			 WHERE term_frequency.term = :query
			   AND documents_published.publicationDate <= ' . time() . '
		  GROUP BY term_frequency.documentPath, term_frequency.term
		  ORDER BY score DESC
		';
        if (!$stmt = $db->prepare($sql)) {
            throw new \RuntimeException('SQLite exception: <pre>' . print_r($db->errorInfo(),
                    true) . '</pre> for SQL:<pre>' . $sql . '</pre>');
        }
        $stmt->bindValue(':query', $token);
        $stmt->bindValue(':queryNorm', $queryNorm);
        if (!$stmt->execute()) {
            throw new \RuntimeException('SQLite exception: <pre>' . print_r($db->errorInfo(),
                    true) . '</pre> for SQL:<pre>' . $sql . '</pre>');
        }
        return $stmt->fetchAll(\PDO::FETCH_CLASS, SearchResult::class);
    }
386108
public static void putDoubleNormalizedKey(double value, MemorySegment target, int offset,
			int numBytes) {
		long lValue = Double.doubleToLongBits(value);
		lValue ^= ((lValue >> (Long.SIZE - 1)) | Long.MIN_VALUE);
		NormalizedKeyUtil.putUnsignedLongNormalizedKey(lValue, target, offset, numBytes);
	}
491915
public static void vNormalize(float[] v) {
        float d = (float) (1.0f / Math.sqrt(sqr(v[0]) + sqr(v[1]) + sqr(v[2])));
        if (d != 0) {
            v[0] *= d;
            v[1] *= d;
            v[2] *= d;
        }
    }
537405
public void setTargetNormal( double nx, double ny, double nz )
    {
        double h,f,c,vx,vy,hvx;

        vx = ny;
        vy = -nx;
        c = nz;
        
        h = (1-c)/(1-c*c);
        hvx = h*vx;
        f = (c < 0) ? -c : c;                
        
        if( f < 1.0 - 1.0E-4 ) 
        {
            m00=c + hvx*vx;
            m01=hvx*vy;
            m02=-vy;
            m10=hvx*vy;
            m11=c + h*vy*vy;
            m12=vx;
            m20=vy;
            m21=-vx;
            m22=c;
        }
        else
        {
            // if "from" and "to" vectors are nearly parallel
            m00=1;
            m01=0;
            m02=0;
            m10=0;
            m11=1;
            m12=0;
            m20=0;
            m21=0;
            if( c > 0 )
            {
                m22=1;                
            }
            else
            {
                m22=-1;
            }
        }
        
    }
261916
function queryRxNormApproximate(medname, maxEntries, callback) {
    // maxEntries is optional
    if (!callback) {
        callback = maxEntries;
        maxEntries = 5;
    }

    query("http://rxnav.nlm.nih.gov/REST/approximateTerm.json", {
        term: medname,
        maxEntries: maxEntries
    }, callback);
}
1142396
protected function normalize_query_param( $query_param ) {
		$prefix = 'comment_';

		switch ( $query_param ) {
			case 'id':
				$normalized = $prefix . 'ID';
				break;
			case 'post':
				$normalized = $prefix . 'post_ID';
				break;
			case 'parent':
				$normalized = $prefix . 'parent';
				break;
			case 'include':
				$normalized = 'comment__in';
				break;
			default:
				$normalized = $prefix . $query_param;
				break;
		}

		return $normalized;
	}
943028
protected function setQueryParams(array $params)
    {
        foreach ($params as $key => $value) {
            $this->setQueryParam($key, $value);
        }
    }
1122987
protected function _normalizeParams(array &$params)
    {
        ksort($params, \SORT_STRING);
        array_walk($params, function (&$value) {
            if (is_numeric($value)) {
                $value = (string)$value;
            }
        });

        if (isset($params['?'])) {
            $this->_normalizeParams($params['?']);
        }
    }
451307
protected function setQueryParam(Request $request, $value)
    {
        $queryParams = $request->getQueryParams();
        $queryParams[$this->queryParam] = $value;
        $request->setQueryParams($queryParams);
    }
598224
protected static function normalizeQuery(?string $query): ?string
    {
        if ($query === null) {
            return null;
        }

        if (!static::isValidQuery($query)) {
            $message = sprintf('Invalid URI query: %s', $query);
            throw new DomainException($message);
        }

        return static::encodeQuery(static::decode($query, static::UNRESERVED_SET));
    }
137408
public static void applyPageConfig(MultivaluedMap<String, String> queryParams, Query query) {
        Integer maxRows = getSingleIntegerParam(queryParams.get(PER_PAGE_PARAM_NAME));

        if (maxRows == null && DEFAULT_PER_PAGE != null && DEFAULT_PER_PAGE > 0) {
            maxRows = DEFAULT_PER_PAGE;
        }

        if (maxRows != null) {
            if (maxRows <= 0) {
                maxRows = SYS_DEFAULT_PER_PAGE;
            }
            if (MAX_PER_PAGE != -1 && maxRows > MAX_PER_PAGE) {
                maxRows = MAX_PER_PAGE;
            }
            query.setMaxRows(maxRows);
        }

        Integer firstRow = getSingleIntegerParam(queryParams.get(PAGE_PARAM_NAME));
        if (firstRow != null && maxRows != null) {
            if (firstRow < 1) {
                firstRow = 1;
            }
            firstRow--;
            firstRow = firstRow * maxRows;
            query.setFirstRow(firstRow);
        }
    }