22
33from __future__ import annotations
44
5- from typing import Union , Optional
5+ from typing import List , Union , Optional
66from typing_extensions import Literal , overload
77
88import httpx
@@ -1278,7 +1278,10 @@ def search(
12781278 self ,
12791279 * ,
12801280 query : str ,
1281+ autocomplete : bool | Omit = omit ,
1282+ query_by : List [Literal ["name" , "domain" ]] | Omit = omit ,
12811283 tags : SequenceNotStr [str ] | Omit = omit ,
1284+ typo_tolerance : int | Omit = omit ,
12821285 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
12831286 # The extra values given here take precedence over values defined on the client or passed to this method.
12841287 extra_headers : Headers | None = None ,
@@ -1287,23 +1290,25 @@ def search(
12871290 timeout : float | httpx .Timeout | None | NotGiven = not_given ,
12881291 ) -> BrandSearchResponse :
12891292 """
1290- Search brands by name or domain and get back up to 10 lightweight matches
1291- (domain, name, logo). Name matches rank ahead of domain matches; within each
1292- group the most popular brands come first: by Tranco rank, then market cap for
1293- brands outside the Tranco list, with text relevance breaking ties. Matching is
1294- prefix-based with no typo tolerance, so it is suited to autocomplete. Only
1295- brands already in the Context.dev index are returned — use /brand/retrieve to
1296- fetch (and index) a specific domain. Free on Pro and Scale plans; costs 1 credit
1297- per request on the Free and Starter plans.
1293+ Search indexed brands by name or domain
12981294
12991295 Args:
1300- query: Search term, matched against brand names and domains by prefix (e.g. 'nike',
1296+ query: Search term, matched against the fields selected by queryBy (e.g. 'nike',
13011297 'nike.com', 'nik').
13021298
1299+ autocomplete: Whether the search term matches by prefix, so partial words match as they are
1300+ typed (e.g. 'nik' matches Nike). Set to false to match whole words only.
1301+
1302+ query_by: Fields to match the search term against, as a comma-separated list or repeated
1303+ parameter: 'name', 'domain', or both. Defaults to both.
1304+
13031305 tags: Optional comma-separated caller-defined tags for tracking this request. Tags are
13041306 recorded on the request's usage log and can be used to filter usage on the
13051307 dashboard usage page. Up to 20 tags, each 1-50 characters.
13061308
1309+ typo_tolerance: Maximum number of typos tolerated when matching, from 0 to 2. Defaults to 0 (no
1310+ typo tolerance).
1311+
13071312 extra_headers: Send extra headers
13081313
13091314 extra_query: Add additional query parameters to the request
@@ -1322,7 +1327,10 @@ def search(
13221327 query = maybe_transform (
13231328 {
13241329 "query" : query ,
1330+ "autocomplete" : autocomplete ,
1331+ "query_by" : query_by ,
13251332 "tags" : tags ,
1333+ "typo_tolerance" : typo_tolerance ,
13261334 },
13271335 brand_search_params .BrandSearchParams ,
13281336 ),
@@ -2583,7 +2591,10 @@ async def search(
25832591 self ,
25842592 * ,
25852593 query : str ,
2594+ autocomplete : bool | Omit = omit ,
2595+ query_by : List [Literal ["name" , "domain" ]] | Omit = omit ,
25862596 tags : SequenceNotStr [str ] | Omit = omit ,
2597+ typo_tolerance : int | Omit = omit ,
25872598 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
25882599 # The extra values given here take precedence over values defined on the client or passed to this method.
25892600 extra_headers : Headers | None = None ,
@@ -2592,23 +2603,25 @@ async def search(
25922603 timeout : float | httpx .Timeout | None | NotGiven = not_given ,
25932604 ) -> BrandSearchResponse :
25942605 """
2595- Search brands by name or domain and get back up to 10 lightweight matches
2596- (domain, name, logo). Name matches rank ahead of domain matches; within each
2597- group the most popular brands come first: by Tranco rank, then market cap for
2598- brands outside the Tranco list, with text relevance breaking ties. Matching is
2599- prefix-based with no typo tolerance, so it is suited to autocomplete. Only
2600- brands already in the Context.dev index are returned — use /brand/retrieve to
2601- fetch (and index) a specific domain. Free on Pro and Scale plans; costs 1 credit
2602- per request on the Free and Starter plans.
2606+ Search indexed brands by name or domain
26032607
26042608 Args:
2605- query: Search term, matched against brand names and domains by prefix (e.g. 'nike',
2609+ query: Search term, matched against the fields selected by queryBy (e.g. 'nike',
26062610 'nike.com', 'nik').
26072611
2612+ autocomplete: Whether the search term matches by prefix, so partial words match as they are
2613+ typed (e.g. 'nik' matches Nike). Set to false to match whole words only.
2614+
2615+ query_by: Fields to match the search term against, as a comma-separated list or repeated
2616+ parameter: 'name', 'domain', or both. Defaults to both.
2617+
26082618 tags: Optional comma-separated caller-defined tags for tracking this request. Tags are
26092619 recorded on the request's usage log and can be used to filter usage on the
26102620 dashboard usage page. Up to 20 tags, each 1-50 characters.
26112621
2622+ typo_tolerance: Maximum number of typos tolerated when matching, from 0 to 2. Defaults to 0 (no
2623+ typo tolerance).
2624+
26122625 extra_headers: Send extra headers
26132626
26142627 extra_query: Add additional query parameters to the request
@@ -2627,7 +2640,10 @@ async def search(
26272640 query = await async_maybe_transform (
26282641 {
26292642 "query" : query ,
2643+ "autocomplete" : autocomplete ,
2644+ "query_by" : query_by ,
26302645 "tags" : tags ,
2646+ "typo_tolerance" : typo_tolerance ,
26312647 },
26322648 brand_search_params .BrandSearchParams ,
26332649 ),
0 commit comments