Class Search

Properties

Methods

Properties

enabled: boolean = false

Whether the search is enabled.

false

Methods

  • Enables the search.

    Returns Promise<void>

  • Searches for places, locations, and categories.

    Parameters

    • term: string

      The search term.

    • options: {
          enterpriseCategories?: {
              fields?: {
                  description?: boolean;
                  locations.name?: boolean;
                  name?: boolean;
              };
              limit?: number;
          };
          enterpriseLocations?: {
              fields?: {
                  description?: boolean;
                  name?: boolean;
                  tags?: boolean;
              };
              limit?: number;
          };
          places?: {
              fields?: {
                  description?: boolean;
                  name?: boolean;
              };
              limit?: number;
          };
      } = {}

      The search options.

      • OptionalenterpriseCategories?: {
            fields?: {
                description?: boolean;
                locations.name?: boolean;
                name?: boolean;
            };
            limit?: number;
        }

        Options for searching categories.

        • Optionalfields?: {
              description?: boolean;
              locations.name?: boolean;
              name?: boolean;
          }

          Fields to search in categories.

          • Optionaldescription?: boolean

            Enable searching by category description

          • Optionallocations.name?: boolean

            Enable searching by names of locations within the category

          • Optionalname?: boolean

            Enable searching by category name

        • Optionallimit?: number

          Maximum number of category results to return

      • OptionalenterpriseLocations?: {
            fields?: {
                description?: boolean;
                name?: boolean;
                tags?: boolean;
            };
            limit?: number;
        }

        Options for searching locations.

        • Optionalfields?: {
              description?: boolean;
              name?: boolean;
              tags?: boolean;
          }

          Fields to search in locations.

          • Optionaldescription?: boolean

            Enable searching by location description

          • Optionalname?: boolean

            Enable searching by location name

          • Optionaltags?: boolean

            Enable searching by location tags

        • Optionallimit?: number

          Maximum number of location results to return

      • Optionalplaces?: {
            fields?: {
                description?: boolean;
                name?: boolean;
            };
            limit?: number;
        }

        Options for searching places.

        • Optionalfields?: {
              description?: boolean;
              name?: boolean;
          }

          Fields to search in places.

          • Optionaldescription?: boolean

            Enable searching by place description

          • Optionalname?: boolean

            Enable searching by place name

        • Optionallimit?: number

          Maximum number of place results to return

    Returns Promise<SearchResult>

    The search results.

    const results = await search.query('Coffee Shop');
    console.log(results.locations);
  • Suggests the names of places, locations, and categories.

    Parameters

    • term: string

      The search term.

    • options: {
          enterpriseLocations?: {
              enabled?: boolean;
          };
          places?: {
              enabled?: boolean;
          };
      } = {}

      The suggest options.

      • OptionalenterpriseLocations?: {
            enabled?: boolean;
        }

        Options for searching locations.

        • Optionalenabled?: boolean

          Enable searching by location name

      • Optionalplaces?: {
            enabled?: boolean;
        }

        Options for searching places.

        • Optionalenabled?: boolean

          Enable searching by place name

    Returns Promise<Suggestion[]>

    The search suggestions.

    const suggestions = await search.suggest('Coffee');
    console.log(suggestions);