@wix/wix-data-items-common 1.0.164 → 1.0.166
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/api/WixDataSearch.ts"],"sourcesContent":["import { WixDataResult } from './WixDataResult'\nimport { WixDataReadOptions } from './types'\nimport { WixDataFilter } from './WixDataFilter'\n\n/**\n * @builder\n * Represents a search operation to be performed on a Wix Data collection.\n * Allows for building complex search requests by specifying search expressions, modes, filters, sorting, and pagination.\n */\nexport interface WixDataSearch {\n /**\n * Specifies the text to search in the collection.\n *\n * The `expression()` method sets the search query. Search terms are separated by whitespace.\n *\n * @param queryText - Text to search in the collection.\n * @returns Refined WixDataSearch object.\n */\n expression(queryText: string): WixDataSearch\n\n /**\n * Enables fuzzy search for approximate text matching.\n *\n * The `fuzzy()` method enables fuzzy search. This allows for approximate matches that closely resemble the search expression even if they don't exactly match.\n *\n * @returns Refined WixDataSearch object.\n */\n fuzzy(): WixDataSearch\n\n /**\n * Sets the search mode to **AND**.\n *\n * When in **AND** mode, an item must include all specified search terms to be included in the results. For example, the search expression \"red car\" in **AND** mode only retrieves items that include both \"red\" and \"car\".\n *\n * @returns Refined WixDataSearch object.\n */\n andMode(): WixDataSearch\n\n /**\n * Sets the search mode to **OR**.\n *\n * When in **OR** mode, an item must include at least one of the specified search terms to be included in the results. For example, the search expression \"red car\" in **OR** mode retrieves items that include \"red\", \"car\", or both.\n *\n * @returns Refined WixDataSearch object.\n */\n orMode(): WixDataSearch\n\n /**\n * Runs the search operation.\n *\n * The `run()` method searches the collection for the specified expression. It returns a Promise that resolves to a [`WixDataResult`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-result/introduction) that contains the matching items and search metadata.\n *\n * Search operations are [eventually consistent](https://dev.wix.com/docs/sdk/backend-modules/data/eventual-consistency) and might not reflect recent changes.\n * @param options - Options for building the search operation.\n * @returns Promise that resolves to a [`WixDataResult`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-result/introduction) containing the matching items and search metadata.\n */\n run(options?: WixDataReadOptions): Promise<WixDataResult>\n\n /**\n * Sorts search results by the specified fields in descending order.\n *\n * The `descending()` method refines the search to sort results by the specified fields in descending order. If you specify more than one field, `descending()` sorts the results in descending order by each field in the order they are listed.\n *\n * You can sort the following types:\n * - **Number**: Sorts numerically.\n * - **Date**: Sorts by date and time.\n * - **String**: Sorts lexicographically, so `\"abc\"` comes before `\"XYZ\"`.\n * - **Reference**: Compares by the ID of the referenced item as a String.\n *\n * If a field contains a number as a String, that value is sorted alphabetically and not numerically.\n * Items that do not have a value for the specified sort field are ranked lowest.\n *\n * @public\n * @documentationMaturity preview\n * @param fields - Fields by which to sort results in descending order.\n * @requiredField fields\n * @returns Refined WixDataSearch object.\n */\n descending(...fields: string[]): WixDataSearch\n /**\n * @param fields - Array of fields by which to sort results in descending order.\n * @returns Refined WixDataSearch object.\n */\n descending(fields: string[]): WixDataSearch\n /**\n * @param fields - Fields by which to sort results in descending order.\n * @returns Refined WixDataSearch object.\n */\n descending(...fields: any): WixDataSearch\n\n /**\n * Sorts search results in ascending order by the specified fields.\n *\n * The `ascending()` method refines the search to sort results by the specified fields in ascending order. If you specify more than one field, `ascending()` sorts the results in ascending order by each field in the order they are listed.\n *\n * You can sort the following types:\n * - **Number**: Sorts numerically.\n * - **Date**: Sorts by date and time.\n * - **String**: Sorts lexicographically, so `\"abc\"` comes before `\"XYZ\"`.\n * - **Reference**: Compares by the ID of the referenced item as a String.\n *\n * If a field contains a number as a String, that value is sorted alphabetically and not numerically.\n * Items that do not have a value for the specified sort field are ranked lowest.\n *\n * @public\n * @documentationMaturity preview\n * @param fields - Fields by which to sort results in ascending order.\n * @requiredField fields\n * @returns Refined WixDataSearch object.\n */\n ascending(...fields: string[]): WixDataSearch\n /**\n * @param fields - Array of fields by which to sort results in ascending order.\n * @returns Refined WixDataSearch object.\n */\n ascending(fields: string[]): WixDataSearch\n /**\n * @param fields - Fields by which to sort results in ascending order.\n * @returns Refined WixDataSearch object.\n */\n ascending(...fields: any): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value equals the specified value.\n *\n * The `eq()` method refines the search to only match items where the value of the specified field equals the specified `value`. It only matches values of the same type. For example, a number value stored as a String type does not match the same number stored as a Number type.\n *\n * Matching strings with `eq()` is case-sensitive, so `\"text\"` is not considered equal to `\"Text\"`.\n *\n * If the field contains an array, `eq()` matches the item if at least one array element equals the specified `value`.\n *\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n eq(field: string, value: any): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value does not equal the specified value.\n *\n * The `ne()` method refines the search to only match items where the value of the specified field does not equal the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored as a String type is considered not equal to the same number stored as a Number type.\n *\n * Matching strings with `ne()` is case-sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of `field` is an array, `ne()` includes items in which none of the elements of the array match the specified `value`.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to not match.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n ne(field: string, value: any): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value is greater than or equal to the specified value.\n *\n * The `ge()` method refines the search to only match items where the value of the specified field is greater than or equal to the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following types of fields can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"abc\"` is greater than or equal to `\"ABC\"`, but `\"ABC\"` is not greater than or equal to `\"abc\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to compare against.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n ge(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value is greater than the specified value.\n *\n * The `gt()` method refines the search to only match items where the value of the specified field is greater than the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest.\n *\n * The following types of fields can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"text\"` is greater than `\"Text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to compare against.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n gt(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value is less than or equal to the specified value.\n *\n * The `le()` method refines the search to only match items where the value of the specified field is less than or equal to the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest.\n *\n * The following types of fields can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"ABC\"` is less than or equal to `\"abc\"`, but `\"abc\"` is not less than or equal to `\"ABC\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to compare with.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n le(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value is less than the specified value.\n *\n * The `lt()` method refines the search to only match items where the value of the specified field is less than the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest.\n *\n * The following types of fields can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"Text\"` is less than `\"text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to compare with.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n lt(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field has a value that isn't `null` or `undefined`.\n *\n * The `isNotEmpty()` method refines the search to only match items where the value of the specified field is not `null` or `undefined`.\n *\n * If the field contains any value at all for a given item, including an empty string or an invalid value, that item matches the search filter.\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to check for a non-empty value.\n * @requiredField field\n * @returns Refined WixDataSearch object.\n */\n isNotEmpty(field: string): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field does not exist or does not have any value (is null or undefined).\n *\n * The `isEmpty()` method refines the search to only match items where the specified field does not exist or where its value is `null` or `undefined`.\n *\n * If the field contains any value at all for a given item, including an empty string or an invalid value, that item does not match the search filter.\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to check for an empty or non-existent value.\n * @requiredField field\n * @returns Refined WixDataSearch object.\n */\n isEmpty(field: string): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value starts with a specified string.\n *\n * The `startsWith()` method refines the search to only match items where the value of the specified field starts with the specified `string`. Matching with `startsWith()` is case-sensitive, so searching for `\"Sun\"` does not match an item that contains the text `\"sunshine\"`.\n *\n * You can only use `startsWith()` with a field whose value is a String or Reference. When using a Reference, `startsWith()` matches by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the `value` parameter.\n * @requiredField field\n * @param value - String to look for at the beginning of the specified field value.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n startsWith(field: string, value: string): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value equals any of the specified values.\n *\n * The `hasSome()` method refines the search to only match items where the value of the specified field equals any of the specified values.\n *\n * Matching strings with `hasSome()` is case-sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the specified field contains an array, `hasSome()` matches if any of the elements in that array match any of the specified values.\n *\n * If the specified field contains multiple references, pass item IDs as the values. `hasSome()` matches if any of the multiple references match any of the specified ID values.\n *\n * You can specify multiple values to match by providing an array of String, Number, or Date types as the `values` parameters.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `values`.\n * @requiredField field\n * @param values - Values to match.\n * @requiredField values\n * @returns Refined WixDataSearch object.\n */\n hasSome(field: string, ...values: string[] | number[] | Date[]): WixDataSearch\n\n /**\n * Overload for `hasSome()`. Refines a search to match items whose specified field value equals any of the specified values.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the provided values.\n * @requiredField field\n * @param values - An array of values to match.\n * @requiredField values\n * @returns Refined WixDataSearch object.\n */\n hasSome(field: string, values: string[] | number[] | Date[]): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value equals all of the specified values.\n *\n * The `hasAll()` method refines the search to only match items where the value of the specified field equals all of the specified values.\n *\n * Matching strings with `hasAll()` is case-sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of the specified field is an array, `hasAll()` matches if there is a match in the elements of that array for all of the specified values.\n *\n * You can specify a list of values to match by providing an array of String, Number, or Date types as the `values` parameters.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `values`.\n * @requiredField field\n * @param values - Values to match. All specified values must be present.\n * @requiredField values\n * @returns Refined WixDataSearch object.\n */\n hasAll(field: string, ...values: string[] | number[] | Date[]): WixDataSearch\n\n /**\n * Overload for `hasAll()`. Refines a search to match items whose specified field values equals all of the specified values.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the provided values.\n * @requiredField field\n * @param values - Array of values to match. All elements in the array must be present.\n * @requiredField values\n * @returns Refined WixDataSearch object.\n */\n hasAll(field: string, values: string[] | number[] | Date[]): WixDataSearch\n\n /**\n * Adds an `or` condition to the search filter.\n *\n * The `or()` method adds an inclusive `or` condition to the search filter. The search returns all the items that match the filter as defined up to the `or()` method, the items that match the filter passed to the `or()` method, and the items that match both.\n *\n * > **Note**: The `or()` method requires 2 or more filters. Used on its own, it might produce unexpected results.\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as an `or` condition.\n * @requiredField filter\n * @returns Refined WixDataSearch object.\n */\n or(filter: WixDataFilter): WixDataSearch\n\n /**\n * Adds an `and` condition to the search filter.\n *\n * The `and()` method adds an `and` condition to the search filter. A search with an `and` returns all the items that match both the filter as defined up to the `and()` method, and the filter passed to the `and()` method.\n *\n * When chaining multiple filter methods to a search, an `and` condition is often assumed by default. For example, the search returns results whose status is active **and** age is greater than 25:\n *\n * ```javascript\n * items\n * .search(\"myCollection\")\n * .expression(\"some text\")\n * .eq(\"status\", \"active\")\n * .gt(\"age\", 25);\n * ```\n *\n * The `and()` method is needed when using compound filters. For example, the final search in this set of operations returns results whose status is either pending or rejected **and** age is either less than 25 or greater than 65:\n *\n * ```javascript\n * let statusFilter = items\n * .filter()\n * .eq(\"status\", \"pending\")\n * .or(items.filter().eq(\"status\", \"rejected\"));\n *\n * let ageFilter = items\n * .filter()\n * .lt(\"age\", 25)\n * .or(items.filter().gt(\"age\", 65));\n *\n * let finalSearch = items\n * .search(\"myCollection\")\n * .expression(\"some text\")\n * .and(statusFilter)\n * .and(ageFilter);\n * ```\n *\n * > **Note**: The `and()` method requires 2 or more filters.\n *\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial search filter as an `and` condition.\n * @requiredField filter\n * @returns Refined WixDataSearch object.\n */\n and(filter: WixDataFilter): WixDataSearch\n\n /**\n * Adds a `not` condition to the search filter.\n *\n * The `not()` method adds a `not` condition to the search filter. A search with a `not` returns all the items that match the filter as defined up to the `not()` method and don't match the filter passed to the `not()` method.\n *\n * If the search filter only contains a `not()` method, it returns all the items that don't match the filter specified to the method.\n *\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as a `not` condition.\n * @requiredField filter\n * @returns Refined WixDataSearch object.\n */\n not(filter: WixDataFilter): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value is within a specified range.\n *\n * The `between()` method refines the search to only match items where the value of the specified field is greater than or equal to `rangeStart` and less than `rangeEnd`.\n *\n * It only matches values of the same type. For example, a number value stored as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest.\n *\n * The following types of fields can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so\n * - `\"A\"` and `\"M\"` are between `\"A\"` and `\"Z\"`, but `\"a\"`, `\"m\"`, `\"z\"` and `\"Z\"` are not.\n * - `\"A\"`, `\"M\"`, `\"Z\"`, and `\"a\"` are between `\"A\"` and `\"z\"`, but `\"z\"` is not.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `rangeStart` and `rangeEnd`.\n * @requiredField field\n * @param rangeStart - Starting value of the range to match (inclusive).\n * @requiredField rangeStart\n * @param rangeEnd - Ending value of the range to match (exclusive).\n * @requiredField rangeEnd\n * @returns Refined WixDataSearch object.\n */\n between(\n field: string,\n rangeStart: string | number | Date,\n rangeEnd: string | number | Date\n ): WixDataSearch\n\n /**\n * Lists the fields to return in the search results.\n *\n * The `fields()` method specifies which fields to return in the search results.\n *\n * You can use `include()` together with `fields()` to get referenced items.\n *\n * When `fields()` receives an empty or an invalid field, the search behaves as follows:\n * - When no fields are specified, the search returns all fields.\n * - When multiple fields are specified but some are invalid, invalid fields are ignored and valid fields are returned.\n * - When only invalid fields are specified, only the default `_id` field is returned.\n * @public\n * @documentationMaturity preview\n * @param fields - Fields to return.\n * @requiredField fields\n * @returns Refined WixDataSearch object.\n */\n fields(...fields: string[]): WixDataSearch\n\n /**\n * Limits the number of items the search returns.\n *\n * The `limit()` method defines the number of results a search operation returns in each page. Only one page of results is retrieved at a time. The `next()` and `prev()` methods of the [`WixDataResult`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-result/introduction) object are used to navigate the pages of a search result.\n *\n * By default, `limit` is set to `100`.\n *\n * The maximum value that `limit()` can accept is `1000`.\n *\n * @public\n * @documentationMaturity preview\n * @param limitNumber - Number of items to return, which is also the `pageSize` of the results object.\n * @requiredField limitNumber\n * @returns Refined WixDataSearch object.\n */\n limit(limitNumber: number): WixDataSearch\n\n /**\n * Sets the number of items to skip before returning search results.\n *\n * The `skip()` method defines the number of results to skip in the search results before returning new search results.\n *\n * For example, if your search matches 50 items, but you set `skip` to 10, the results returned skips the first 10 items that match and return the 11th through 50th items.\n *\n * By default, `skip()` is set to 0.\n * @public\n * @documentationMaturity preview\n * @param skipCount - Number of items to skip before returning the results.\n * @requiredField skipCount\n * @returns Refined WixDataSearch object.\n */\n skip(skipCount: number): WixDataSearch\n\n /**\n * Includes referenced items for the specified fields.\n *\n * The `include()` method refines a search so that the items returned in the search results include the full referenced items for the specified fields.\n *\n * For example, suppose you have a **books** collection with an **author** field that references an **authors** collection. Searching the **books** collection with an `include(\"author\")` returns the relevant book items, and each item includes the full referenced author item in the book's `author` field.\n *\n * When searching a collection that contains a reference field without using the `include()` method:\n * - Single reference field: returned items contain only the ID of the referenced item, and not the full referenced items.\n * - Multiple reference field: returned items do not contain the multiple reference field at all.\n *\n * When including a field with multiple references, the following limitations apply:\n * - Only one field with multiple references can be included.\n * - The search returns an error if more than 50 items are returned, regardless of any search limit set using the `limit()` method.\n * - Each returned item can include up to 50 referenced items. If there are more than 50 referenced items, only 50 are returned, and the `partialIncludes` field of the returned `WixDataResult` is `true`.\n *\n * > **Note:** The `include()` method is not supported for [single-item collections](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection).\n *\n * @public\n * @documentationMaturity preview\n * @param fields - Fields for which to include referenced items.\n * @requiredField fields\n * @returns Refined WixDataSearch object.\n */\n include(...fields: string[]): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified field in a search's results.\n * @public\n * @documentationMaturity preview\n * @param field - Field for which to include referenced items.\n * @param limit - Optional limit for the number of referenced items to include (behavior may vary).\n * @returns Refined WixDataSearch object.\n */\n include(field: string, limit?: number): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified fields in a search's results.\n * @public\n * @documentationMaturity preview\n * @param field1 - First field for which to include referenced items.\n * @param field2 - Second field for which to include referenced items.\n * @param limit - Optional limit for the number of referenced items to include (behavior may vary).\n * @returns Refined WixDataSearch object.\n */\n include(field1: string, field2: string, limit?: number): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified fields in a search's results.\n * @public\n * @documentationMaturity preview\n * @param field1 - First field.\n * @param field2 - Second field.\n * @param field3 - Third field.\n * @param limit - Optional limit.\n * @returns Refined WixDataSearch object.\n */\n include(\n field1: string,\n field2: string,\n field3: string,\n limit?: number\n ): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified fields in a search's results.\n * @public\n * @documentationMaturity preview\n * @param field1 - First field.\n * @param field2 - Second field.\n * @param field3 - Third field.\n * @param field4 - Fourth field.\n * @param limit - Optional limit.\n * @returns Refined WixDataSearch object.\n */\n include(\n field1: string,\n field2: string,\n field3: string,\n field4: string,\n limit?: number\n ): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified fields in a search's results.\n * @public\n * @documentationMaturity preview\n * @param field1 - First field.\n * @param field2 - Second field.\n * @param field3 - Third field.\n * @param field4 - Fourth field.\n * @param field5 - Fifth field.\n * @param limit - Optional limit.\n * @returns Refined WixDataSearch object.\n */\n include(\n field1: string,\n field2: string,\n field3: string,\n field4: string,\n field5: string,\n limit?: number\n ): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified fields in a search's results.\n * Allows specifying multiple field names and an optional limit.\n * @public\n * @documentationMaturity preview\n * @param fieldNamesAndLimit - Array of field names, optionally followed by a limit number.\n * @returns Refined WixDataSearch object.\n */\n include(...fieldNamesAndLimit: [...string[], number]): WixDataSearch\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/api/WixDataSearch.ts"],"sourcesContent":["import { WixDataResult } from './WixDataResult'\nimport { WixDataReadOptions } from './types'\nimport { WixDataFilter } from './WixDataFilter'\n\n/**\n * @builder\n * Represents a search operation to be performed on a Wix Data collection.\n * Allows for building complex search requests by specifying search expressions, modes, filters, sorting, and pagination.\n */\nexport interface WixDataSearch {\n /**\n * Specifies the text to search in the collection.\n *\n * The `expression()` method sets the search query.\n *\n * Search terms are separated by whitespace. For example, the expression `red car white roof` includes four search terms: `red`, `car`, `white`, and `roof`. Use [`andMode()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-search/and-mode) to require all terms to be present, or [`orMode()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-search/or-mode) to require at least one term to be present.\n *\n * @param queryText - Text to search in the collection.\n * @returns Refined WixDataSearch object.\n */\n expression(queryText: string): WixDataSearch\n\n /**\n * Enables fuzzy search for approximate text matching.\n *\n * The `fuzzy()` method enables fuzzy search. This allows for approximate matches that closely resemble the search expression even if they don't exactly match.\n *\n * @returns Refined WixDataSearch object.\n */\n fuzzy(): WixDataSearch\n\n /**\n * Sets the search mode to **AND**.\n *\n * When in **AND** mode, an item must include all specified search terms to be included in the results. For example, the search expression \"red car\" in **AND** mode only retrieves items that include both \"red\" and \"car\".\n *\n * @returns Refined WixDataSearch object.\n */\n andMode(): WixDataSearch\n\n /**\n * Sets the search mode to **OR**.\n *\n * When in **OR** mode, an item must include at least one of the specified search terms to be included in the results. For example, the search expression \"red car\" in **OR** mode retrieves items that include \"red\", \"car\", or both.\n *\n * @returns Refined WixDataSearch object.\n */\n orMode(): WixDataSearch\n\n /**\n * Runs the search operation.\n *\n * The `run()` method searches the collection for the specified expression. It returns a Promise that resolves to a [`WixDataResult`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-result/introduction) that contains the matching items and search metadata.\n *\n * Search operations are [eventually consistent](https://dev.wix.com/docs/sdk/backend-modules/data/eventual-consistency) and might not reflect recent changes.\n * @param options - Options for building the search operation.\n * @returns Promise that resolves to a [`WixDataResult`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-result/introduction) containing the matching items and search metadata.\n */\n run(options?: WixDataReadOptions): Promise<WixDataResult>\n\n /**\n * Sorts search results by the specified fields in descending order.\n *\n * The `descending()` method refines the search to sort results by the specified fields in descending order. If you specify more than one field, `descending()` sorts the results in descending order by each field in the order they are listed.\n *\n * You can sort the following types:\n * - **Number**: Sorts numerically.\n * - **Date**: Sorts by date and time.\n * - **String**: Sorts lexicographically, so `\"abc\"` comes before `\"XYZ\"`.\n * - **Reference**: Compares by the ID of the referenced item as a String.\n *\n * If a field contains a number as a String, that value is sorted alphabetically and not numerically.\n * Items that do not have a value for the specified sort field are ranked lowest.\n *\n * @public\n * @documentationMaturity preview\n * @param fields - Fields by which to sort results in descending order.\n * @requiredField fields\n * @returns Refined WixDataSearch object.\n */\n descending(...fields: string[]): WixDataSearch\n /**\n * @param fields - Array of fields by which to sort results in descending order.\n * @returns Refined WixDataSearch object.\n */\n descending(fields: string[]): WixDataSearch\n /**\n * @param fields - Fields by which to sort results in descending order.\n * @returns Refined WixDataSearch object.\n */\n descending(...fields: any): WixDataSearch\n\n /**\n * Sorts search results in ascending order by the specified fields.\n *\n * The `ascending()` method refines the search to sort results by the specified fields in ascending order. If you specify more than one field, `ascending()` sorts the results in ascending order by each field in the order they are listed.\n *\n * You can sort the following types:\n * - **Number**: Sorts numerically.\n * - **Date**: Sorts by date and time.\n * - **String**: Sorts lexicographically, so `\"abc\"` comes before `\"XYZ\"`.\n * - **Reference**: Compares by the ID of the referenced item as a String.\n *\n * If a field contains a number as a String, that value is sorted alphabetically and not numerically.\n * Items that do not have a value for the specified sort field are ranked lowest.\n *\n * @public\n * @documentationMaturity preview\n * @param fields - Fields by which to sort results in ascending order.\n * @requiredField fields\n * @returns Refined WixDataSearch object.\n */\n ascending(...fields: string[]): WixDataSearch\n /**\n * @param fields - Array of fields by which to sort results in ascending order.\n * @returns Refined WixDataSearch object.\n */\n ascending(fields: string[]): WixDataSearch\n /**\n * @param fields - Fields by which to sort results in ascending order.\n * @returns Refined WixDataSearch object.\n */\n ascending(...fields: any): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value equals the specified value.\n *\n * The `eq()` method refines the search to only match items where the value of the specified field equals the specified `value`. It only matches values of the same type. For example, a number value stored as a String type does not match the same number stored as a Number type.\n *\n * Matching strings with `eq()` is case-sensitive, so `\"text\"` is not considered equal to `\"Text\"`.\n *\n * If the field contains an array, `eq()` matches the item if at least one array element equals the specified `value`.\n *\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n eq(field: string, value: any): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value does not equal the specified value.\n *\n * The `ne()` method refines the search to only match items where the value of the specified field does not equal the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored as a String type is considered not equal to the same number stored as a Number type.\n *\n * Matching strings with `ne()` is case-sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of `field` is an array, `ne()` includes items in which none of the elements of the array match the specified `value`.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to not match.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n ne(field: string, value: any): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value is greater than or equal to the specified value.\n *\n * The `ge()` method refines the search to only match items where the value of the specified field is greater than or equal to the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following types of fields can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"abc\"` is greater than or equal to `\"ABC\"`, but `\"ABC\"` is not greater than or equal to `\"abc\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to compare against.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n ge(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value is greater than the specified value.\n *\n * The `gt()` method refines the search to only match items where the value of the specified field is greater than the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest.\n *\n * The following types of fields can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"text\"` is greater than `\"Text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to compare against.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n gt(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value is less than or equal to the specified value.\n *\n * The `le()` method refines the search to only match items where the value of the specified field is less than or equal to the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest.\n *\n * The following types of fields can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"ABC\"` is less than or equal to `\"abc\"`, but `\"abc\"` is not less than or equal to `\"ABC\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to compare with.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n le(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value is less than the specified value.\n *\n * The `lt()` method refines the search to only match items where the value of the specified field is less than the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest.\n *\n * The following types of fields can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"Text\"` is less than `\"text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to compare with.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n lt(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field has a value that isn't `null` or `undefined`.\n *\n * The `isNotEmpty()` method refines the search to only match items where the value of the specified field is not `null` or `undefined`.\n *\n * If the field contains any value at all for a given item, including an empty string or an invalid value, that item matches the search filter.\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to check for a non-empty value.\n * @requiredField field\n * @returns Refined WixDataSearch object.\n */\n isNotEmpty(field: string): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field does not exist or does not have any value (is null or undefined).\n *\n * The `isEmpty()` method refines the search to only match items where the specified field does not exist or where its value is `null` or `undefined`.\n *\n * If the field contains any value at all for a given item, including an empty string or an invalid value, that item does not match the search filter.\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to check for an empty or non-existent value.\n * @requiredField field\n * @returns Refined WixDataSearch object.\n */\n isEmpty(field: string): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value starts with a specified string.\n *\n * The `startsWith()` method refines the search to only match items where the value of the specified field starts with the specified `string`. Matching with `startsWith()` is case-sensitive, so searching for `\"Sun\"` does not match an item that contains the text `\"sunshine\"`.\n *\n * You can only use `startsWith()` with a field whose value is a String or Reference. When using a Reference, `startsWith()` matches by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the `value` parameter.\n * @requiredField field\n * @param value - String to look for at the beginning of the specified field value.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n startsWith(field: string, value: string): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value equals any of the specified values.\n *\n * The `hasSome()` method refines the search to only match items where the value of the specified field equals any of the specified values.\n *\n * Matching strings with `hasSome()` is case-sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the specified field contains an array, `hasSome()` matches if any of the elements in that array match any of the specified values.\n *\n * If the specified field contains multiple references, pass item IDs as the values. `hasSome()` matches if any of the multiple references match any of the specified ID values.\n *\n * You can specify multiple values to match by providing an array of String, Number, or Date types as the `values` parameters.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `values`.\n * @requiredField field\n * @param values - Values to match.\n * @requiredField values\n * @returns Refined WixDataSearch object.\n */\n hasSome(field: string, ...values: string[] | number[] | Date[]): WixDataSearch\n\n /**\n * Overload for `hasSome()`. Refines a search to match items whose specified field value equals any of the specified values.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the provided values.\n * @requiredField field\n * @param values - An array of values to match.\n * @requiredField values\n * @returns Refined WixDataSearch object.\n */\n hasSome(field: string, values: string[] | number[] | Date[]): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value equals all of the specified values.\n *\n * The `hasAll()` method refines the search to only match items where the value of the specified field equals all of the specified values.\n *\n * Matching strings with `hasAll()` is case-sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of the specified field is an array, `hasAll()` matches if there is a match in the elements of that array for all of the specified values.\n *\n * You can specify a list of values to match by providing an array of String, Number, or Date types as the `values` parameters.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `values`.\n * @requiredField field\n * @param values - Values to match. All specified values must be present.\n * @requiredField values\n * @returns Refined WixDataSearch object.\n */\n hasAll(field: string, ...values: string[] | number[] | Date[]): WixDataSearch\n\n /**\n * Overload for `hasAll()`. Refines a search to match items whose specified field values equals all of the specified values.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the provided values.\n * @requiredField field\n * @param values - Array of values to match. All elements in the array must be present.\n * @requiredField values\n * @returns Refined WixDataSearch object.\n */\n hasAll(field: string, values: string[] | number[] | Date[]): WixDataSearch\n\n /**\n * Adds an `or` condition to the search filter.\n *\n * The `or()` method adds an inclusive `or` condition to the search filter. The search returns all the items that match the filter as defined up to the `or()` method, the items that match the filter passed to the `or()` method, and the items that match both.\n *\n * > **Note**: Calling `or()` without a filter may lead to unexpected results.\n *\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as an `or` condition.\n * @requiredField filter\n * @returns Refined WixDataSearch object.\n */\n or(filter: WixDataFilter): WixDataSearch\n\n /**\n * Adds an `and` condition to the search filter.\n *\n * The `and()` method adds an `and` condition to the search filter. A search with an `and` returns all the items that match both the filter as defined up to the `and()` method, and the filter passed to the `and()` method.\n *\n * When chaining multiple filter methods to a search, an `and` condition is often assumed by default. For example, the search returns results whose status is active **and** age is greater than 25:\n *\n * ```javascript\n * items\n * .search(\"myCollection\")\n * .expression(\"some text\")\n * .eq(\"status\", \"active\")\n * .gt(\"age\", 25);\n * ```\n *\n * The `and()` method is needed when using compound filters. For example, the final search in this set of operations returns results whose status is either pending or rejected **and** age is either less than 25 or greater than 65:\n *\n * ```javascript\n * let statusFilter = items\n * .filter()\n * .eq(\"status\", \"pending\")\n * .or(items.filter().eq(\"status\", \"rejected\"));\n *\n * let ageFilter = items\n * .filter()\n * .lt(\"age\", 25)\n * .or(items.filter().gt(\"age\", 65));\n *\n * let finalSearch = items\n * .search(\"myCollection\")\n * .expression(\"some text\")\n * .and(statusFilter)\n * .and(ageFilter);\n * ```\n *\n * > **Note**: Calling `and()` without a filter may lead to unexpected results.\n *\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial search filter as an `and` condition.\n * @requiredField filter\n * @returns Refined WixDataSearch object.\n */\n and(filter: WixDataFilter): WixDataSearch\n\n /**\n * Adds a `not` condition to the search filter.\n *\n * The `not()` method adds a `not` condition to the search filter. A search with a `not` returns all the items that match the filter as defined up to the `not()` method and don't match the filter passed to the `not()` method.\n *\n * If the search filter only contains a `not()` method, it returns all the items that don't match the filter specified to the method.\n *\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as a `not` condition.\n * @requiredField filter\n * @returns Refined WixDataSearch object.\n */\n not(filter: WixDataFilter): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value is within a specified range.\n *\n * The `between()` method refines the search to only match items where the value of the specified field is greater than or equal to `rangeStart` and less than `rangeEnd`.\n *\n * It only matches values of the same type. For example, a number value stored as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest.\n *\n * The following types of fields can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so\n * - `\"A\"` and `\"M\"` are between `\"A\"` and `\"Z\"`, but `\"a\"`, `\"m\"`, `\"z\"` and `\"Z\"` are not.\n * - `\"A\"`, `\"M\"`, `\"Z\"`, and `\"a\"` are between `\"A\"` and `\"z\"`, but `\"z\"` is not.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `rangeStart` and `rangeEnd`.\n * @requiredField field\n * @param rangeStart - Starting value of the range to match (inclusive).\n * @requiredField rangeStart\n * @param rangeEnd - Ending value of the range to match (exclusive).\n * @requiredField rangeEnd\n * @returns Refined WixDataSearch object.\n */\n between(\n field: string,\n rangeStart: string | number | Date,\n rangeEnd: string | number | Date\n ): WixDataSearch\n\n /**\n * Lists the fields to return in the search results.\n *\n * The `fields()` method specifies which fields to return in the search results.\n *\n * You can use `include()` together with `fields()` to get referenced items.\n *\n * When `fields()` receives an empty or an invalid field, the search behaves as follows:\n * - When no fields are specified, the search returns all fields.\n * - When multiple fields are specified but some are invalid, invalid fields are ignored and valid fields are returned.\n * - When only invalid fields are specified, only the default `_id` field is returned.\n * @public\n * @documentationMaturity preview\n * @param fields - Fields to return.\n * @requiredField fields\n * @returns Refined WixDataSearch object.\n */\n fields(...fields: string[]): WixDataSearch\n\n /**\n * Limits the number of items the search returns.\n *\n * The `limit()` method defines the number of results a search operation returns in each page. Only one page of results is retrieved at a time. The `next()` and `prev()` methods of the [`WixDataResult`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-result/introduction) object are used to navigate the pages of a search result.\n *\n * By default, `limit` is set to `100`.\n *\n * The maximum value that `limit()` can accept is `1000`.\n *\n * @public\n * @documentationMaturity preview\n * @param limitNumber - Number of items to return, which is also the `pageSize` of the results object.\n * @requiredField limitNumber\n * @returns Refined WixDataSearch object.\n */\n limit(limitNumber: number): WixDataSearch\n\n /**\n * Sets the number of items to skip before returning search results.\n *\n * The `skip()` method defines the number of results to skip in the search results before returning new search results.\n *\n * For example, if your search matches 50 items, but you set `skip` to 10, the results returned skips the first 10 items that match and return the 11th through 50th items.\n *\n * By default, `skip()` is set to 0.\n * @public\n * @documentationMaturity preview\n * @param skipCount - Number of items to skip before returning the results.\n * @requiredField skipCount\n * @returns Refined WixDataSearch object.\n */\n skip(skipCount: number): WixDataSearch\n\n /**\n * Includes referenced items for the specified fields.\n *\n * The `include()` method refines a search so that the items returned in the search results include the full referenced items for the specified fields.\n *\n * For example, suppose you have a **books** collection with an **author** field that references an **authors** collection. Searching the **books** collection with an `include(\"author\")` returns the relevant book items, and each item includes the full referenced author item in the book's `author` field.\n *\n * When searching a collection that contains a reference field without using the `include()` method:\n * - Single reference field: returned items contain only the ID of the referenced item, and not the full referenced items.\n * - Multiple reference field: returned items do not contain the multiple reference field at all.\n *\n * When including a field with multiple references, the following limitations apply:\n * - Only one field with multiple references can be included.\n * - The search returns an error if more than 50 items are returned, regardless of any search limit set using the `limit()` method.\n * - Each returned item can include up to 50 referenced items. If there are more than 50 referenced items, only 50 are returned, and the `partialIncludes` field of the returned `WixDataResult` is `true`.\n *\n * > **Note:** The `include()` method is not supported for [single-item collections](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection).\n *\n * @public\n * @documentationMaturity preview\n * @param fields - Fields for which to include referenced items.\n * @requiredField fields\n * @returns Refined WixDataSearch object.\n */\n include(...fields: string[]): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified field in a search's results.\n * @public\n * @documentationMaturity preview\n * @param field - Field for which to include referenced items.\n * @param limit - Optional limit for the number of referenced items to include (behavior may vary).\n * @returns Refined WixDataSearch object.\n */\n include(field: string, limit?: number): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified fields in a search's results.\n * @public\n * @documentationMaturity preview\n * @param field1 - First field for which to include referenced items.\n * @param field2 - Second field for which to include referenced items.\n * @param limit - Optional limit for the number of referenced items to include (behavior may vary).\n * @returns Refined WixDataSearch object.\n */\n include(field1: string, field2: string, limit?: number): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified fields in a search's results.\n * @public\n * @documentationMaturity preview\n * @param field1 - First field.\n * @param field2 - Second field.\n * @param field3 - Third field.\n * @param limit - Optional limit.\n * @returns Refined WixDataSearch object.\n */\n include(\n field1: string,\n field2: string,\n field3: string,\n limit?: number\n ): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified fields in a search's results.\n * @public\n * @documentationMaturity preview\n * @param field1 - First field.\n * @param field2 - Second field.\n * @param field3 - Third field.\n * @param field4 - Fourth field.\n * @param limit - Optional limit.\n * @returns Refined WixDataSearch object.\n */\n include(\n field1: string,\n field2: string,\n field3: string,\n field4: string,\n limit?: number\n ): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified fields in a search's results.\n * @public\n * @documentationMaturity preview\n * @param field1 - First field.\n * @param field2 - Second field.\n * @param field3 - Third field.\n * @param field4 - Fourth field.\n * @param field5 - Fifth field.\n * @param limit - Optional limit.\n * @returns Refined WixDataSearch object.\n */\n include(\n field1: string,\n field2: string,\n field3: string,\n field4: string,\n field5: string,\n limit?: number\n ): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified fields in a search's results.\n * Allows specifying multiple field names and an optional limit.\n * @public\n * @documentationMaturity preview\n * @param fieldNamesAndLimit - Array of field names, optionally followed by a limit number.\n * @returns Refined WixDataSearch object.\n */\n include(...fieldNamesAndLimit: [...string[], number]): WixDataSearch\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -10,7 +10,9 @@ export interface WixDataSearch {
|
|
|
10
10
|
/**
|
|
11
11
|
* Specifies the text to search in the collection.
|
|
12
12
|
*
|
|
13
|
-
* The `expression()` method sets the search query.
|
|
13
|
+
* The `expression()` method sets the search query.
|
|
14
|
+
*
|
|
15
|
+
* Search terms are separated by whitespace. For example, the expression `red car white roof` includes four search terms: `red`, `car`, `white`, and `roof`. Use [`andMode()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-search/and-mode) to require all terms to be present, or [`orMode()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-search/or-mode) to require at least one term to be present.
|
|
14
16
|
*
|
|
15
17
|
* @param queryText - Text to search in the collection.
|
|
16
18
|
* @returns Refined WixDataSearch object.
|
|
@@ -352,7 +354,8 @@ export interface WixDataSearch {
|
|
|
352
354
|
*
|
|
353
355
|
* The `or()` method adds an inclusive `or` condition to the search filter. The search returns all the items that match the filter as defined up to the `or()` method, the items that match the filter passed to the `or()` method, and the items that match both.
|
|
354
356
|
*
|
|
355
|
-
* > **Note**:
|
|
357
|
+
* > **Note**: Calling `or()` without a filter may lead to unexpected results.
|
|
358
|
+
*
|
|
356
359
|
* @public
|
|
357
360
|
* @documentationMaturity preview
|
|
358
361
|
* @param filter - Filter to add to the initial filter as an `or` condition.
|
|
@@ -395,7 +398,7 @@ export interface WixDataSearch {
|
|
|
395
398
|
* .and(ageFilter);
|
|
396
399
|
* ```
|
|
397
400
|
*
|
|
398
|
-
* > **Note**:
|
|
401
|
+
* > **Note**: Calling `and()` without a filter may lead to unexpected results.
|
|
399
402
|
*
|
|
400
403
|
* @public
|
|
401
404
|
* @documentationMaturity preview
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WixDataSearch.d.ts","sourceRoot":"","sources":["../../../src/api/WixDataSearch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B
|
|
1
|
+
{"version":3,"file":"WixDataSearch.d.ts","sourceRoot":"","sources":["../../../src/api/WixDataSearch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;OASG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,CAAA;IAE5C;;;;;;OAMG;IACH,KAAK,IAAI,aAAa,CAAA;IAEtB;;;;;;OAMG;IACH,OAAO,IAAI,aAAa,CAAA;IAExB;;;;;;OAMG;IACH,MAAM,IAAI,aAAa,CAAA;IAEvB;;;;;;;;OAQG;IACH,GAAG,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;IAEzD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,UAAU,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,CAAA;IAC9C;;;OAGG;IACH,UAAU,CAAC,MAAM,EAAE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E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/wix-data-items-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.166",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Rimvydas Gimbutas",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@babel/runtime": "^7.27.0",
|
|
33
33
|
"@types/kind-of": "^6.0.3",
|
|
34
34
|
"@types/safe-json-stringify": "^1.1.5",
|
|
35
|
-
"@wix/filter-builder": "1.0.
|
|
35
|
+
"@wix/filter-builder": "1.0.160",
|
|
36
36
|
"kind-of": "^6.0.3",
|
|
37
37
|
"safe-json-stringify": "^1.2.0"
|
|
38
38
|
},
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"wallaby": {
|
|
86
86
|
"autoDetect": true
|
|
87
87
|
},
|
|
88
|
-
"falconPackageHash": "
|
|
88
|
+
"falconPackageHash": "f2485fe99ee346cd339e18e9cd319c791c323aca4f99631e32960981"
|
|
89
89
|
}
|