export interface SiteDocument { /** * Result ID. * @readonly */ _id?: string; /** The document payload. */ data?: Record | null; } export interface SearchRequest { /** Search query and aggregation information. */ search: Search; /** Document type to search in. */ documentType: DocumentType; /** Language to search in. */ language?: string | null; } export interface Search extends SearchPagingMethodOneOf { /** Paging options to limit and skip the number of items. */ paging?: Paging; /** * Filter object in the following format: * `"filter" : { * "fieldName1": "value1", * "fieldName2":{"$operator":"value2"} * }` * Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains` */ filter?: Record | null; /** * Sort object in the following format: * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]` */ sort?: Sorting[]; /** A search method for grouping data into various categories (facets) and providing summaries for each category. For example, use aggregations to categorize search results by specific price ranges, brand names, or ratings. */ aggregations?: Aggregation[]; /** Search information. */ search?: SearchDetails; } /** @oneof */ export interface SearchPagingMethodOneOf { /** Paging options to limit and skip the number of items. */ paging?: Paging; } export interface Sorting { /** Name of the field to sort by. */ fieldName?: string; /** Sort order. */ order?: SortOrder; } export declare enum SortOrder { ASC = "ASC", DESC = "DESC" } export interface Aggregation extends AggregationKindOneOf { /** Pass if `type` is `VALUE`. A value aggregation calculates metrics such as count for specific fields within a dataset, providing insights into the overall distribution and key statistics of those values. For example, use a value aggregation to get the number of products (count) for each price listed in the store. */ value?: ValueAggregation; /** Pass if `type` is `SCALAR`. A scalar aggregation calculates a single numerical value from a dataset, such as the total, minimum, or maximum value, summarizing the dataset into one key metric. For example, use a scalar aggregation to get the minimum price listed in a store. */ scalar?: ScalarAggregation; /** Pass if `type` is `NESTED`. A nested aggregation is applied to the results of another aggregation. Rather than aggregating directly on the primary dataset, first group data using one aggregation and then apply another aggregation within each group. This allows for more complex analyses that summarize data at different levels of detail or hierarchy. For example, to get the number of products that are in stock and out of stock for each price listed, first perform a value aggregation on the field containing the price, and a second value aggregation on the field indicating whether a product is in stock. You can nest up to a maximum of 3 aggregations. Each aggregation can be either value-based or scalar, allowing flexibility in how the data is grouped and analyzed. */ nested?: NestedAggregation; /** Aggregation name displayed in the return. */ name?: string | null; /** Type of aggregation to perform. */ type?: AggregationType; /** Field to aggregate by. */ fieldPath?: string; } /** @oneof */ export interface AggregationKindOneOf { /** Pass if `type` is `VALUE`. A value aggregation calculates metrics such as count for specific fields within a dataset, providing insights into the overall distribution and key statistics of those values. For example, use a value aggregation to get the number of products (count) for each price listed in the store. */ value?: ValueAggregation; /** Pass if `type` is `SCALAR`. A scalar aggregation calculates a single numerical value from a dataset, such as the total, minimum, or maximum value, summarizing the dataset into one key metric. For example, use a scalar aggregation to get the minimum price listed in a store. */ scalar?: ScalarAggregation; /** Pass if `type` is `NESTED`. A nested aggregation is applied to the results of another aggregation. Rather than aggregating directly on the primary dataset, first group data using one aggregation and then apply another aggregation within each group. This allows for more complex analyses that summarize data at different levels of detail or hierarchy. For example, to get the number of products that are in stock and out of stock for each price listed, first perform a value aggregation on the field containing the price, and a second value aggregation on the field indicating whether a product is in stock. You can nest up to a maximum of 3 aggregations. Each aggregation can be either value-based or scalar, allowing flexibility in how the data is grouped and analyzed. */ nested?: NestedAggregation; } export declare enum ScalarType { /** Unknown scalar type. */ UNKNOWN_SCALAR_TYPE = "UNKNOWN_SCALAR_TYPE", /** Minimum value. */ MIN = "MIN", /** Maximum value. */ MAX = "MAX", /** Sum of values. */ SUM = "SUM" } export declare enum NestedAggregationType { /** Unknown aggregation type. */ UNKNOWN_AGGREGATION_TYPE = "UNKNOWN_AGGREGATION_TYPE", /** An aggregation where result buckets are dynamically built - one per unique value. */ VALUE = "VALUE", /** A single-value metric aggregation - e.g. min, max, sum, avg. */ SCALAR = "SCALAR" } export interface ValueAggregation { /** * Maximum number of aggregation results to return. * Min: `1` * Max: `250` * Default: `10` */ limit?: number | null; } export interface ScalarAggregation { /** Type of scalar aggregation. */ type?: ScalarType; } export interface NestedAggregationItem extends NestedAggregationItemKindOneOf { /** Pass if `type` is `VALUE`. A value aggregation calculates metrics such as count for specific fields within a dataset, providing insights into the overall distribution and key statistics of those values. For example, use a value aggregation to get the number of products (count) for each price listed in the store. */ value?: ValueAggregation; /** Pass if `type` is `SCALAR`. A scalar aggregation calculates a single numerical value from a dataset, such as the total, minimum, or maximum value, summarizing the dataset into one key metric. For example, use a scalar aggregation to get the minimum price listed in a store. */ scalar?: ScalarAggregation; /** Aggregation name displayed in the return. */ name?: string | null; /** Type of aggregation to perform. */ type?: NestedAggregationType; /** Field to aggregate by. */ fieldPath?: string; } /** @oneof */ export interface NestedAggregationItemKindOneOf { /** Pass if `type` is `VALUE`. A value aggregation calculates metrics such as count for specific fields within a dataset, providing insights into the overall distribution and key statistics of those values. For example, use a value aggregation to get the number of products (count) for each price listed in the store. */ value?: ValueAggregation; /** Pass if `type` is `SCALAR`. A scalar aggregation calculates a single numerical value from a dataset, such as the total, minimum, or maximum value, summarizing the dataset into one key metric. For example, use a scalar aggregation to get the minimum price listed in a store. */ scalar?: ScalarAggregation; } export declare enum AggregationType { UNKNOWN_AGGREGATION_TYPE = "UNKNOWN_AGGREGATION_TYPE", /** An aggregation where result buckets are dynamically built - one per unique value. */ VALUE = "VALUE", /** A single-value metric aggregation - e.g. min, max, sum, avg. */ SCALAR = "SCALAR", /** Multi-level aggregation, where each next aggregation is nested within previous one. */ NESTED = "NESTED" } /** List of aggregations. Each aggregation is nested within the previous one. */ export interface NestedAggregation { /** List of aggregations, where each aggregation is nested within previous one. */ nestedAggregations?: NestedAggregationItem[]; } export interface SearchDetails { /** Search term or expression. */ expression?: string | null; /** * Fields to search in. * If the array is empty, all fields are searched. */ fields?: string[]; /** Whether to allow the search function to automatically correct typos or minor mistakes in the search expression. The search function uses an algorithm to find results that are close to the text provided. */ fuzzy?: boolean; } export interface Paging { /** Number of items to load. */ limit?: number | null; /** Number of items to skip in the current sort order. */ offset?: number | null; } export declare enum DocumentType { UNSPECIFIED = "UNSPECIFIED", BLOG_POSTS = "BLOG_POSTS", BOOKING_SERVICES = "BOOKING_SERVICES", EVENTS = "EVENTS", FORUM_CONTENT = "FORUM_CONTENT", ONLINE_PROGRAMS = "ONLINE_PROGRAMS", PROGALLERY_ITEM = "PROGALLERY_ITEM", STORES_PRODUCTS = "STORES_PRODUCTS" } export interface SearchResponse extends SearchResponsePagingOneOf { /** Paging metadata. */ pagingOffsetMetadata?: PagingMetadata; /** Documents matching the search query. */ siteDocumentItems?: SiteDocument[]; /** Aggregated data. */ aggregationData?: AggregationData; } /** @oneof */ export interface SearchResponsePagingOneOf { /** Paging metadata. */ pagingOffsetMetadata?: PagingMetadata; } export interface AggregationData { /** List of the aggregated data results. */ results?: AggregationResults[]; } export interface ValueAggregationResult { /** Value contained in the field specified in `fieldPath` for this aggregation in the request. */ value?: string; /** Number of documents containing the specified value in the specified field. */ count?: number; } export interface ValueResults { /** List of value aggregation results. */ results?: ValueAggregationResult[]; } export interface AggregationResultsScalarResult { /** Type of scalar aggregation. */ type?: ScalarType; /** Value of the scalar aggregation. For example, the minimum, maximum, or total value for the specified field. */ value?: number; } export interface ValueResult { /** Value contained in the field specified in `fieldPath` for this aggregation in the request. */ value?: string; /** Number of documents containing the specified value in the specified field. */ count?: number | null; } export interface ScalarResult { /** Scalar aggregation results. */ value?: number; } export interface NestedResultValue extends NestedResultValueResultOneOf { /** Value aggregation results. */ value?: ValueResult; /** Scalar aggregation results. */ scalar?: ScalarResult; } /** @oneof */ export interface NestedResultValueResultOneOf { /** Value aggregation results. */ value?: ValueResult; /** Scalar aggregation results. */ scalar?: ScalarResult; } export interface Results { /** Aggregation results. */ results?: Record; } /** * Results of `NESTED` aggregation type in a flattened form * aggregations in resulting array are keyed by requested aggregation `name`. */ export interface NestedResults { /** List of nested aggregation results. */ results?: Results[]; } export interface AggregationResults extends AggregationResultsResultOneOf { /** Value aggregation results. */ values?: ValueResults; /** Scalar aggregation results. */ scalar?: AggregationResultsScalarResult; /** Nested aggregation results. */ nested?: NestedResults; /** Aggregation name defined in the request. */ name?: string; /** Type of aggregation that was performed. */ type?: AggregationType; /** Field the data was aggregated by. */ fieldPath?: string; } /** @oneof */ export interface AggregationResultsResultOneOf { /** Value aggregation results. */ values?: ValueResults; /** Scalar aggregation results. */ scalar?: AggregationResultsScalarResult; /** Nested aggregation results. */ nested?: NestedResults; } export interface PagingMetadata { /** Number of items returned in the response. */ count?: number | null; /** Offset that was requested. */ offset?: number | null; /** Total number of items that match the query. */ total?: number | null; /** Whether the server failed to calculate the `total` field. */ tooManyToCount?: boolean | null; } interface SiteDocumentNonNullableFields { _id: string; } interface ValueAggregationResultNonNullableFields { value: string; count: number; } interface ValueResultsNonNullableFields { results: ValueAggregationResultNonNullableFields[]; } interface AggregationResultsScalarResultNonNullableFields { type: ScalarType; value: number; } interface AggregationResultsNonNullableFields { values?: ValueResultsNonNullableFields; scalar?: AggregationResultsScalarResultNonNullableFields; name: string; type: AggregationType; fieldPath: string; } interface AggregationDataNonNullableFields { results: AggregationResultsNonNullableFields[]; } export interface SearchResponseNonNullableFields { siteDocumentItems: SiteDocumentNonNullableFields[]; aggregationData?: AggregationDataNonNullableFields; } /** * Retrieves a list of site documents that match the provided search query and optionally performs aggregations on the data queried. * * The `search()` API supports the document types listed in the [Introduction](https://dev.wix.com/docs/sdk/backend-modules/search/wix-site-search/introduction), each with its own schema. These schemas define the fields available for filtering, sorting, and free-text searching. * * To learn more about working with the search query, see [API Query Language](https://dev.wix.com/docs/sdk/articles/working-with-the-sdk/api-query-language). * @param search - Search query and aggregation information. * @param documentType - Document type to search in. * @public * @documentationMaturity preview * @requiredField documentType * @requiredField search * @permissionId SEARCH.SITE_DOCUMENT_READ * @permissionScope Read Site Documents * @permissionScopeId SCOPE.SITE_SEARCH.ALL * @applicableIdentity APP * @applicableIdentity VISITOR */ export declare function search(search: Search, documentType: DocumentType, options?: SearchOptions): Promise; export interface SearchOptions { /** Language to search in. */ language?: string | null; } export {};