AlgoliaSearch\Index::searchSynonyms PHP Method

searchSynonyms() public method

public searchSynonyms ( $query, array $synonymType = [], null $page = null, null $hitsPerPage = null ) : mixed
$query
$synonymType array
$page null
$hitsPerPage null
return mixed
    public function searchSynonyms($query, array $synonymType = array(), $page = null, $hitsPerPage = null)
    {
        $params = array();
        if ($query !== null) {
            $params['query'] = $query;
        }
        if (count($synonymType) > 0) {
            $types = array();
            foreach ($synonymType as $type) {
                if (is_integer($type)) {
                    $types[] = SynonymType::getSynonymsTypeString($type);
                } else {
                    $types[] = $type;
                }
            }
            $params['type'] = implode(',', $types);
        }
        if ($page !== null) {
            $params['page'] = $page;
        }
        if ($hitsPerPage !== null) {
            $params['hitsPerPage'] = $hitsPerPage;
        }
        return $this->client->request($this->context, 'POST', '/1/indexes/' . $this->urlIndexName . '/synonyms/search', null, $params, $this->context->readHostsArray, $this->context->connectTimeout, $this->context->readTimeout);
    }