Searches for profiles within a tenant.

        For example, search by raw queries "software engineer in Mountain View"
        or search by structured filters (location filter, education filter,
        etc.).

        See ``SearchProfilesRequest`` for more information.

        Example:
            >>> from google.cloud import talent_v4beta1
            >>>
            >>> client = talent_v4beta1.ProfileServiceClient()
            >>>
            >>> parent = client.tenant_path('[PROJECT]', '[TENANT]')
            >>>
            >>> # TODO: Initialize `request_metadata`:
            >>> request_metadata = {}
            >>>
            >>> # Iterate over all results
            >>> for element in client.search_profiles(parent, request_metadata):
            ...     # process element
            ...     pass
            >>>
            >>>
            >>> # Alternatively:
            >>>
            >>> # Iterate over results one page at a time
            >>> for page in client.search_profiles(parent, request_metadata).pages:
            ...     for element in page:
            ...         # process element
            ...         pass

        Args:
            parent (str): Required.

                The resource name of the tenant to search within.

                The format is "projects/{project\_id}/tenants/{tenant\_id}", for
                example, "projects/api-test-project/tenants/foo".
            request_metadata (Union[dict, ~google.cloud.talent_v4beta1.types.RequestMetadata]): Required.

                The meta information collected about the profile search user. This is used
                to improve the search quality of the service. These values are provided by
                users, and must be precise and consistent.

                If a dict is provided, it must be of the same form as the protobuf
                message :class:`~google.cloud.talent_v4beta1.types.RequestMetadata`
            profile_query (Union[dict, ~google.cloud.talent_v4beta1.types.ProfileQuery]): Optional.

                Search query to execute. See ``ProfileQuery`` for more details.

                If a dict is provided, it must be of the same form as the protobuf
                message :class:`~google.cloud.talent_v4beta1.types.ProfileQuery`
            page_size (int): The maximum number of resources contained in the
                underlying API response. If page streaming is performed per-
                resource, this parameter does not affect the return value. If page
                streaming is performed per-page, this determines the maximum number
                of resources in a page.
            offset (int): Optional.

                An integer that specifies the current offset (that is, starting result)
                in search results. This field is only considered if ``page_token`` is
                unset.

                The maximum allowed value is 5000. Otherwise an error is thrown.

                For example, 0 means to search from the first profile, and 10 means to
                search from the 11th profile. This can be used for pagination, for
                example pageSize = 10 and offset = 10 means to search from the second
                page.
            disable_spell_check (bool): Optional.

                This flag controls the spell-check feature. If ``false``, the service
                attempts to correct a misspelled query.

                For example, "enginee" is corrected to "engineer".
            order_by (str): Optional.

                The criteria that determines how search results are sorted. Defaults is
                "relevance desc" if no value is specified.

                Supported options are:

                -  "relevance desc": By descending relevance, as determined by the API
                   algorithms.
                -  "update\_date desc": Sort by ``Profile.update_date`` in descending
                   order (recently updated profiles first).
                -  "create\_date desc": Sort by ``Profile.create_date`` in descending
                   order (recently created profiles first).
                -  "first\_name": Sort by ``PersonStrcuturedName.given_name`` in
                   ascending order.
                -  "first\_name desc": Sort by ``PersonStrcuturedName.given_name`` in
                   descending order.
                -  "last\_name": Sort by ``PersonStrcuturedName.family_name`` in
                   ascending order.
                -  "last\_name desc": Sort by ``PersonStrcuturedName.family_name`` in
                   ascending order.
            case_sensitive_sort (bool): Optional.

                When sort by field is based on alphabetical order, sort values case
                sensitively (based on ASCII) when the value is set to true. Default value
                is case in-sensitive sort (false).
            histogram_queries (list[Union[dict, ~google.cloud.talent_v4beta1.types.HistogramQuery]]): Optional.

                A list of expressions specifies histogram requests against matching
                profiles for ``SearchProfilesRequest``.

                The expression syntax looks like a function definition with optional
                parameters.

                Function syntax: function\_name(histogram\_facet[, list of buckets])

                Data types:

                -  Histogram facet: facet names with format [a-zA-Z][a-zA-Z0-9\_]+.
                -  String: string like "any string with backslash escape for quote(")."
                -  Number: whole number and floating point number like 10, -1 and -0.01.
                -  List: list of elements with comma(,) separator surrounded by square
                   brackets. For example, [1, 2, 3] and ["one", "two", "three"].

                Built-in constants:

                -  MIN (minimum number similar to java Double.MIN\_VALUE)
                -  MAX (maximum number similar to java Double.MAX\_VALUE)

                Built-in functions:

                -  bucket(start, end[, label]) Bucket build-in function creates a bucket
                   with range of \`start, end). Note that the end is exclusive. For
                   example, bucket(1, MAX, "positive number") or bucket(1, 10).

                Histogram Facets:

                -  admin1: Admin1 is a global placeholder for referring to state,
                   province, or the particular term a country uses to define the
                   geographic structure below the country level. Examples include states
                   codes such as "CA", "IL", "NY", and provinces, such as "BC".
                -  locality: Locality is a global placeholder for referring to city,
                   town, or the particular term a country uses to define the geographic
                   structure below the admin1 level. Examples include city names such as
                   "Mountain View" and "New York".
                -  extended\_locality: Extended locality is concatenated version of
                   admin1 and locality with comma separator. For example, "Mountain
                   View, CA" and "New York, NY".
                -  postal\_code: Postal code of profile which follows locale code.
                -  country: Country code (ISO-3166-1 alpha-2 code) of profile, such as
                   US, JP, GB.
                -  job\_title: Normalized job titles specified in EmploymentHistory.
                -  company\_name: Normalized company name of profiles to match on.
                -  institution: The school name. For example, "MIT", "University of
                   California, Berkeley"
                -  degree: Highest education degree in ISCED code. Each value in degree
                   covers specific level of education, without any expansion to upper
                   nor lower levels of education degree.
                -  experience\_in\_months: experience in months. 0 means 0 month to 1
                   month (exclusive).
                -  application\_date: The application date specifies application start
                   dates. See [ApplicationDateFilter\` for more details.
                -  application\_outcome\_reason: The application outcome reason
                   specifies the outcome reasons of job application. See
                   ``ApplicationOutcomeReasonFilter`` for more details.
                -  application\_last\_stage: The application last stage specifies the
                   last stage of job application. See ``ApplicationLastStageFilter`` for
                   more details.
                -  application\_job\_title: The application job title specifies the job
                   applied for in the application. See ``ApplicationJobFilter`` for more
                   details.
                -  application\_status: The application status specifies the status of
                   job application. See ``ApplicationStatusFilter`` for more details.
                -  hirable\_status: Hirable status specifies the profile's hirable
                   status.
                -  string\_custom\_attribute: String custom attributes. Values can be
                   accessed via square bracket notation like
                   string\_custom\_attribute["key1"].
                -  numeric\_custom\_attribute: Numeric custom attributes. Values can be
                   accessed via square bracket notation like
                   numeric\_custom\_attribute["key1"].

                Example expressions:

                -  count(admin1)
                -  count(experience\_in\_months, [bucket(0, 12, "1 year"), bucket(12,
                   36, "1-3 years"), bucket(36, MAX, "3+ years")])
                -  count(string\_custom\_attribute["assigned\_recruiter"])
                -  count(numeric\_custom\_attribute["favorite\_number"], [bucket(MIN, 0,
                   "negative"), bucket(0, MAX, "non-negative")])

                If a dict is provided, it must be of the same form as the protobuf
                message :class:`~google.cloud.talent_v4beta1.types.HistogramQuery`
            retry (Optional[google.api_core.retry.Retry]):  A retry object used
                to retry requests. If ``None`` is specified, requests will not
                be retried.
            timeout (Optional[float]): The amount of time, in seconds, to wait
                for the request to complete. Note that if ``retry`` is
                specified, the timeout applies to each individual attempt.
            metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
                that is provided to the method.

        Returns:
            A :class:`~google.gax.PageIterator` instance. By default, this
            is an iterable of :class:`~google.cloud.talent_v4beta1.types.HistogramQueryResult` instances.
            This object can also be configured to iterate over the pages
            of the response through the `options` parameter.

        Raises:
            google.api_core.exceptions.GoogleAPICallError: If the request
                    failed for any reason.
            google.api_core.exceptions.RetryError: If the request failed due
                    to a retryable error and retry attempts failed.
            ValueError: If the parameters are invalid.

def search_profiles(
        self,
        parent,
        request_metadata,
        profile_query=None,
        page_size=None,
        offset=None,
        disable_spell_check=None,
        order_by=None,
        case_sensitive_sort=None,
        histogram_queries=None,
        retry=google.api_core.gapic_v1.method.DEFAULT,
        timeout=google.api_core.gapic_v1.method.DEFAULT,
        metadata=None,
    ):
        """
        Searches for profiles within a tenant.

        For example, search by raw queries "software engineer in Mountain View"
        or search by structured filters (location filter, education filter,
        etc.).

        See ``SearchProfilesRequest`` for more information.

        Example:
            >>> from google.cloud import talent_v4beta1
            >>>
            >>> client = talent_v4beta1.ProfileServiceClient()
            >>>
            >>> parent = client.tenant_path('[PROJECT]', '[TENANT]')
            >>>
            >>> # TODO: Initialize `request_metadata`:
            >>> request_metadata = {}
            >>>
            >>> # Iterate over all results
            >>> for element in client.search_profiles(parent, request_metadata):
            ...     # process element
            ...     pass
            >>>
            >>>
            >>> # Alternatively:
            >>>
            >>> # Iterate over results one page at a time
            >>> for page in client.search_profiles(parent, request_metadata).pages:
            ...     for element in page:
            ...         # process element
            ...         pass

        Args:
            parent (str): Required.

                The resource name of the tenant to search within.

                The format is "projects/{project\_id}/tenants/{tenant\_id}", for
                example, "projects/api-test-project/tenants/foo".
            request_metadata (Union[dict, ~google.cloud.talent_v4beta1.types.RequestMetadata]): Required.

                The meta information collected about the profile search user. This is used
                to improve the search quality of the service. These values are provided by
                users, and must be precise and consistent.

                If a dict is provided, it must be of the same form as the protobuf
                message :class:`~google.cloud.talent_v4beta1.types.RequestMetadata`
            profile_query (Union[dict, ~google.cloud.talent_v4beta1.types.ProfileQuery]): Optional.

                Search query to execute. See ``ProfileQuery`` for more details.

                If a dict is provided, it must be of the same form as the protobuf
                message :class:`~google.cloud.talent_v4beta1.types.ProfileQuery`
            page_size (int): The maximum number of resources contained in the
                underlying API response. If page streaming is performed per-
                resource, this parameter does not affect the return value. If page
                streaming is performed per-page, this determines the maximum number
                of resources in a page.
            offset (int): Optional.

                An integer that specifies the current offset (that is, starting result)
                in search results. This field is only considered if ``page_token`` is
                unset.

                The maximum allowed value is 5000. Otherwise an error is thrown.

                For example, 0 means to search from the first profile, and 10 means to
                search from the 11th profile. This can be used for pagination, for
                example pageSize = 10 and offset = 10 means to search from the second
                page.
            disable_spell_check (bool): Optional.

                This flag controls the spell-check feature. If ``false``, the service
                attempts to correct a misspelled query.

                For example, "enginee" is corrected to "engineer".
            order_by (str): Optional.

                The criteria that determines how search results are sorted. Defaults is
                "relevance desc" if no value is specified.

                Supported options are:

                -  "relevance desc": By descending relevance, as determined by the API
                   algorithms.
                -  "update\_date desc": Sort by ``Profile.update_date`` in descending
                   order (recently updated profiles first).
                -  "create\_date desc": Sort by ``Profile.create_date`` in descending
                   order (recently created profiles first).
                -  "first\_name": Sort by ``PersonStrcuturedName.given_name`` in
                   ascending order.
                -  "first\_name desc": Sort by ``PersonStrcuturedName.given_name`` in
                   descending order.
                -  "last\_name": Sort by ``PersonStrcuturedName.family_name`` in
                   ascending order.
                -  "last\_name desc": Sort by ``PersonStrcuturedName.family_name`` in
                   ascending order.
            case_sensitive_sort (bool): Optional.

                When sort by field is based on alphabetical order, sort values case
                sensitively (based on ASCII) when the value is set to true. Default value
                is case in-sensitive sort (false).
            histogram_queries (list[Union[dict, ~google.cloud.talent_v4beta1.types.HistogramQuery]]): Optional.

                A list of expressions specifies histogram requests against matching
                profiles for ``SearchProfilesRequest``.

                The expression syntax looks like a function definition with optional
                parameters.

                Function syntax: function\_name(histogram\_facet[, list of buckets])

                Data types:

                -  Histogram facet: facet names with format [a-zA-Z][a-zA-Z0-9\_]+.
                -  String: string like "any string with backslash escape for quote(")."
                -  Number: whole number and floating point number like 10, -1 and -0.01.
                -  List: list of elements with comma(,) separator surrounded by square
                   brackets. For example, [1, 2, 3] and ["one", "two", "three"].

                Built-in constants:

                -  MIN (minimum number similar to java Double.MIN\_VALUE)
                -  MAX (maximum number similar to java Double.MAX\_VALUE)

                Built-in functions:

                -  bucket(start, end[, label]) Bucket build-in function creates a bucket
                   with range of \`start, end). Note that the end is exclusive. For
                   example, bucket(1, MAX, "positive number") or bucket(1, 10).

                Histogram Facets:

                -  admin1: Admin1 is a global placeholder for referring to state,
                   province, or the particular term a country uses to define the
                   geographic structure below the country level. Examples include states
                   codes such as "CA", "IL", "NY", and provinces, such as "BC".
                -  locality: Locality is a global placeholder for referring to city,
                   town, or the particular term a country uses to define the geographic
                   structure below the admin1 level. Examples include city names such as
                   "Mountain View" and "New York".
                -  extended\_locality: Extended locality is concatenated version of
                   admin1 and locality with comma separator. For example, "Mountain
                   View, CA" and "New York, NY".
                -  postal\_code: Postal code of profile which follows locale code.
                -  country: Country code (ISO-3166-1 alpha-2 code) of profile, such as
                   US, JP, GB.
                -  job\_title: Normalized job titles specified in EmploymentHistory.
                -  company\_name: Normalized company name of profiles to match on.
                -  institution: The school name. For example, "MIT", "University of
                   California, Berkeley"
                -  degree: Highest education degree in ISCED code. Each value in degree
                   covers specific level of education, without any expansion to upper
                   nor lower levels of education degree.
                -  experience\_in\_months: experience in months. 0 means 0 month to 1
                   month (exclusive).
                -  application\_date: The application date specifies application start
                   dates. See [ApplicationDateFilter\` for more details.
                -  application\_outcome\_reason: The application outcome reason
                   specifies the outcome reasons of job application. See
                   ``ApplicationOutcomeReasonFilter`` for more details.
                -  application\_last\_stage: The application last stage specifies the
                   last stage of job application. See ``ApplicationLastStageFilter`` for
                   more details.
                -  application\_job\_title: The application job title specifies the job
                   applied for in the application. See ``ApplicationJobFilter`` for more
                   details.
                -  application\_status: The application status specifies the status of
                   job application. See ``ApplicationStatusFilter`` for more details.
                -  hirable\_status: Hirable status specifies the profile's hirable
                   status.
                -  string\_custom\_attribute: String custom attributes. Values can be
                   accessed via square bracket notation like
                   string\_custom\_attribute["key1"].
                -  numeric\_custom\_attribute: Numeric custom attributes. Values can be
                   accessed via square bracket notation like
                   numeric\_custom\_attribute["key1"].

                Example expressions:

                -  count(admin1)
                -  count(experience\_in\_months, [bucket(0, 12, "1 year"), bucket(12,
                   36, "1-3 years"), bucket(36, MAX, "3+ years")])
                -  count(string\_custom\_attribute["assigned\_recruiter"])
                -  count(numeric\_custom\_attribute["favorite\_number"], [bucket(MIN, 0,
                   "negative"), bucket(0, MAX, "non-negative")])

                If a dict is provided, it must be of the same form as the protobuf
                message :class:`~google.cloud.talent_v4beta1.types.HistogramQuery`
            retry (Optional[google.api_core.retry.Retry]):  A retry object used
                to retry requests. If ``None`` is specified, requests will not
                be retried.
            timeout (Optional[float]): The amount of time, in seconds, to wait
                for the request to complete. Note that if ``retry`` is
                specified, the timeout applies to each individual attempt.
            metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
                that is provided to the method.

        Returns:
            A :class:`~google.gax.PageIterator` instance. By default, this
            is an iterable of :class:`~google.cloud.talent_v4beta1.types.HistogramQueryResult` instances.
            This object can also be configured to iterate over the pages
            of the response through the `options` parameter.

        Raises:
            google.api_core.exceptions.GoogleAPICallError: If the request
                    failed for any reason.
            google.api_core.exceptions.RetryError: If the request failed due
                    to a retryable error and retry attempts failed.
            ValueError: If the parameters are invalid.
        """
        # Wrap the transport method to add retry and timeout logic.
        if "search_profiles" not in self._inner_api_calls:
            self._inner_api_calls[
                "search_profiles"
            ] = google.api_core.gapic_v1.method.wrap_method(
                self.transport.search_profiles,
                default_retry=self._method_configs["SearchProfiles"].retry,
                default_timeout=self._method_configs["SearchProfiles"].timeout,
                client_info=self._client_info,
            )

        request = profile_service_pb2.SearchProfilesRequest(
            parent=parent,
            request_metadata=request_metadata,
            profile_query=profile_query,
            page_size=page_size,
            offset=offset,
            disable_spell_check=disable_spell_check,
            order_by=order_by,
            case_sensitive_sort=case_sensitive_sort,
            histogram_queries=histogram_queries,
        )
        iterator = google.api_core.page_iterator.GRPCIterator(
            client=None,
            method=functools.partial(
                self._inner_api_calls["search_profiles"],
                retry=retry,
                timeout=timeout,
                metadata=metadata,
            ),
            request=request,
            items_field="histogram_query_results",
            request_token_field="page_token",
            response_token_field="next_page_token",
        )
        return iterator