<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/discoveryengine/v1/search_service.proto

namespace Google\Cloud\DiscoveryEngine\V1\SearchResponse\SearchResult;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * A set of ranking signals.
 *
 * Generated from protobuf message <code>google.cloud.discoveryengine.v1.SearchResponse.SearchResult.RankSignals</code>
 */
class RankSignals extends \Google\Protobuf\Internal\Message
{
    /**
     * Keyword matching adjustment.
     *
     * Generated from protobuf field <code>optional float keyword_similarity_score = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $keyword_similarity_score = null;
    /**
     * Semantic relevance adjustment.
     *
     * Generated from protobuf field <code>optional float relevance_score = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $relevance_score = null;
    /**
     * Semantic similarity adjustment.
     *
     * Generated from protobuf field <code>optional float semantic_similarity_score = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $semantic_similarity_score = null;
    /**
     * Predicted conversion rate adjustment as a rank.
     *
     * Generated from protobuf field <code>optional float pctr_rank = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $pctr_rank = null;
    /**
     * Topicality adjustment as a rank.
     *
     * Generated from protobuf field <code>optional float topicality_rank = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $topicality_rank = null;
    /**
     * Age of the document in hours.
     *
     * Generated from protobuf field <code>optional float document_age = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $document_age = null;
    /**
     * Combined custom boosts for a doc.
     *
     * Generated from protobuf field <code>optional float boosting_factor = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $boosting_factor = null;
    /**
     * The default rank of the result.
     *
     * Generated from protobuf field <code>float default_rank = 32 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $default_rank = 0.0;
    /**
     * A list of custom clearbox signals.
     *
     * Generated from protobuf field <code>repeated .google.cloud.discoveryengine.v1.SearchResponse.SearchResult.RankSignals.CustomSignal custom_signals = 33 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $custom_signals;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type float $keyword_similarity_score
     *           Keyword matching adjustment.
     *     @type float $relevance_score
     *           Semantic relevance adjustment.
     *     @type float $semantic_similarity_score
     *           Semantic similarity adjustment.
     *     @type float $pctr_rank
     *           Predicted conversion rate adjustment as a rank.
     *     @type float $topicality_rank
     *           Topicality adjustment as a rank.
     *     @type float $document_age
     *           Age of the document in hours.
     *     @type float $boosting_factor
     *           Combined custom boosts for a doc.
     *     @type float $default_rank
     *           The default rank of the result.
     *     @type array<\Google\Cloud\DiscoveryEngine\V1\SearchResponse\SearchResult\RankSignals\CustomSignal>|\Google\Protobuf\Internal\RepeatedField $custom_signals
     *           A list of custom clearbox signals.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Discoveryengine\V1\SearchService::initOnce();
        parent::__construct($data);
    }

    /**
     * Keyword matching adjustment.
     *
     * Generated from protobuf field <code>optional float keyword_similarity_score = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return float
     */
    public function getKeywordSimilarityScore()
    {
        return isset($this->keyword_similarity_score) ? $this->keyword_similarity_score : 0.0;
    }

    public function hasKeywordSimilarityScore()
    {
        return isset($this->keyword_similarity_score);
    }

    public function clearKeywordSimilarityScore()
    {
        unset($this->keyword_similarity_score);
    }

    /**
     * Keyword matching adjustment.
     *
     * Generated from protobuf field <code>optional float keyword_similarity_score = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param float $var
     * @return $this
     */
    public function setKeywordSimilarityScore($var)
    {
        GPBUtil::checkFloat($var);
        $this->keyword_similarity_score = $var;

        return $this;
    }

    /**
     * Semantic relevance adjustment.
     *
     * Generated from protobuf field <code>optional float relevance_score = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return float
     */
    public function getRelevanceScore()
    {
        return isset($this->relevance_score) ? $this->relevance_score : 0.0;
    }

    public function hasRelevanceScore()
    {
        return isset($this->relevance_score);
    }

    public function clearRelevanceScore()
    {
        unset($this->relevance_score);
    }

    /**
     * Semantic relevance adjustment.
     *
     * Generated from protobuf field <code>optional float relevance_score = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param float $var
     * @return $this
     */
    public function setRelevanceScore($var)
    {
        GPBUtil::checkFloat($var);
        $this->relevance_score = $var;

        return $this;
    }

    /**
     * Semantic similarity adjustment.
     *
     * Generated from protobuf field <code>optional float semantic_similarity_score = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return float
     */
    public function getSemanticSimilarityScore()
    {
        return isset($this->semantic_similarity_score) ? $this->semantic_similarity_score : 0.0;
    }

    public function hasSemanticSimilarityScore()
    {
        return isset($this->semantic_similarity_score);
    }

    public function clearSemanticSimilarityScore()
    {
        unset($this->semantic_similarity_score);
    }

    /**
     * Semantic similarity adjustment.
     *
     * Generated from protobuf field <code>optional float semantic_similarity_score = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param float $var
     * @return $this
     */
    public function setSemanticSimilarityScore($var)
    {
        GPBUtil::checkFloat($var);
        $this->semantic_similarity_score = $var;

        return $this;
    }

    /**
     * Predicted conversion rate adjustment as a rank.
     *
     * Generated from protobuf field <code>optional float pctr_rank = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return float
     */
    public function getPctrRank()
    {
        return isset($this->pctr_rank) ? $this->pctr_rank : 0.0;
    }

    public function hasPctrRank()
    {
        return isset($this->pctr_rank);
    }

    public function clearPctrRank()
    {
        unset($this->pctr_rank);
    }

    /**
     * Predicted conversion rate adjustment as a rank.
     *
     * Generated from protobuf field <code>optional float pctr_rank = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param float $var
     * @return $this
     */
    public function setPctrRank($var)
    {
        GPBUtil::checkFloat($var);
        $this->pctr_rank = $var;

        return $this;
    }

    /**
     * Topicality adjustment as a rank.
     *
     * Generated from protobuf field <code>optional float topicality_rank = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return float
     */
    public function getTopicalityRank()
    {
        return isset($this->topicality_rank) ? $this->topicality_rank : 0.0;
    }

    public function hasTopicalityRank()
    {
        return isset($this->topicality_rank);
    }

    public function clearTopicalityRank()
    {
        unset($this->topicality_rank);
    }

    /**
     * Topicality adjustment as a rank.
     *
     * Generated from protobuf field <code>optional float topicality_rank = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param float $var
     * @return $this
     */
    public function setTopicalityRank($var)
    {
        GPBUtil::checkFloat($var);
        $this->topicality_rank = $var;

        return $this;
    }

    /**
     * Age of the document in hours.
     *
     * Generated from protobuf field <code>optional float document_age = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return float
     */
    public function getDocumentAge()
    {
        return isset($this->document_age) ? $this->document_age : 0.0;
    }

    public function hasDocumentAge()
    {
        return isset($this->document_age);
    }

    public function clearDocumentAge()
    {
        unset($this->document_age);
    }

    /**
     * Age of the document in hours.
     *
     * Generated from protobuf field <code>optional float document_age = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param float $var
     * @return $this
     */
    public function setDocumentAge($var)
    {
        GPBUtil::checkFloat($var);
        $this->document_age = $var;

        return $this;
    }

    /**
     * Combined custom boosts for a doc.
     *
     * Generated from protobuf field <code>optional float boosting_factor = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return float
     */
    public function getBoostingFactor()
    {
        return isset($this->boosting_factor) ? $this->boosting_factor : 0.0;
    }

    public function hasBoostingFactor()
    {
        return isset($this->boosting_factor);
    }

    public function clearBoostingFactor()
    {
        unset($this->boosting_factor);
    }

    /**
     * Combined custom boosts for a doc.
     *
     * Generated from protobuf field <code>optional float boosting_factor = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param float $var
     * @return $this
     */
    public function setBoostingFactor($var)
    {
        GPBUtil::checkFloat($var);
        $this->boosting_factor = $var;

        return $this;
    }

    /**
     * The default rank of the result.
     *
     * Generated from protobuf field <code>float default_rank = 32 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return float
     */
    public function getDefaultRank()
    {
        return $this->default_rank;
    }

    /**
     * The default rank of the result.
     *
     * Generated from protobuf field <code>float default_rank = 32 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param float $var
     * @return $this
     */
    public function setDefaultRank($var)
    {
        GPBUtil::checkFloat($var);
        $this->default_rank = $var;

        return $this;
    }

    /**
     * A list of custom clearbox signals.
     *
     * Generated from protobuf field <code>repeated .google.cloud.discoveryengine.v1.SearchResponse.SearchResult.RankSignals.CustomSignal custom_signals = 33 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getCustomSignals()
    {
        return $this->custom_signals;
    }

    /**
     * A list of custom clearbox signals.
     *
     * Generated from protobuf field <code>repeated .google.cloud.discoveryengine.v1.SearchResponse.SearchResult.RankSignals.CustomSignal custom_signals = 33 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param array<\Google\Cloud\DiscoveryEngine\V1\SearchResponse\SearchResult\RankSignals\CustomSignal>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setCustomSignals($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\SearchResponse\SearchResult\RankSignals\CustomSignal::class);
        $this->custom_signals = $arr;

        return $this;
    }

}


