module Crunchbase::Utilities::Autocomplete

Autocomplete on Searches

Public Instance Methods

autocomplete(keyword, **args) click to toggle source

endpoint: /autocompletes

Suggests matching Identifier entities based on the query and entity_def_ids provided.

query * string
   Value to perform the autocomplete search with.
collection_ids string
   A comma separated list of collection ids to search against.
   Leaving this blank means it will search across all identifiers.
   Entity defs can be constrained to specific facets by providing them as facet collections.
   Relationship collections will resolve to their underlying entity def.

   Collection ids are:
     organizations, people, funding_rounds, acquisitions, investments, events,
     press_references, funds, event_appearances, ipos, ownerships, categories,
     category_groups, locations, jobs
limit integer
   Number of results to retrieve; default = 10, max = 25

Example for organizations

raw_data = {
   query: keyword,
   collection_ids: 'organizations'
}
# File lib/crunchbase/utilities/autocomplete.rb, line 36
def autocomplete(keyword, **args)
  crunchbase_autocompletes(wrapper_autocompletes_data(keyword, args))
end

Private Instance Methods

crunchbase_autocompletes(raw_data) click to toggle source
# File lib/crunchbase/utilities/autocomplete.rb, line 42
def crunchbase_autocompletes(raw_data)
  Crunchbase::Autocompletes::Client.new(raw_data).autocompletes
end
wrapper_autocompletes_data(keyword, **args) click to toggle source
# File lib/crunchbase/utilities/autocomplete.rb, line 46
def wrapper_autocompletes_data(keyword, **args)
  { query: keyword }.merge(args)
end