Class: HubSpotSDK::Resources::Cms::SiteSearch

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot_sdk/resources/cms/site_search.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ SiteSearch

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of SiteSearch.

Parameters:



106
107
108
# File 'lib/hubspot_sdk/resources/cms/site_search.rb', line 106

def initialize(client:)
  @client = client
end

Instance Method Details

#get_indexed_data(content_id, type: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::IndexedData

Return all indexed data for an asset (e.g., page, blog post, HubDB table), specified by ID. This is useful when debugging why a particular asset is not returned from a custom search.

Parameters:

Returns:

See Also:



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/hubspot_sdk/resources/cms/site_search.rb', line 20

def get_indexed_data(content_id, params = {})
  parsed, options = HubSpotSDK::Cms::SiteSearchGetIndexedDataParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["cms/site-search/2026-03/indexed-data/%1$s", content_id],
    query: query,
    model: HubSpotSDK::Cms::IndexedData,
    options: options
  )
end

#search(analytics: nil, autocomplete: nil, boost_limit: nil, boost_recent: nil, domain: nil, group_id: nil, hubdb_query: nil, language: nil, length: nil, limit: nil, match_prefix: nil, offset: nil, path_prefix: nil, popularity_boost: nil, property: nil, q: nil, table_id: nil, type: nil, types: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::PublicSearchResults

Returns any website content matching the given search criteria for a given HubSpot account. Searches can be filtered by content type, domain, or URL path. Includes options for weighing results by recency and popularity, along with language support.

Parameters:

Returns:

See Also:



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/hubspot_sdk/resources/cms/site_search.rb', line 82

def search(params = {})
  parsed, options = HubSpotSDK::Cms::SiteSearchSearchParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "cms/site-search/2026-03/search",
    query: query.transform_keys(
      boost_limit: "boostLimit",
      boost_recent: "boostRecent",
      group_id: "groupId",
      hubdb_query: "hubdbQuery",
      match_prefix: "matchPrefix",
      path_prefix: "pathPrefix",
      popularity_boost: "popularityBoost",
      table_id: "tableId"
    ),
    model: HubSpotSDK::Cms::PublicSearchResults,
    options: options
  )
end