@wix/wix-data-items-common 1.0.159 → 1.0.161
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 for 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 for across all fields in the collection.\n * @returns Current WixDataSearch object for method chaining.\n */\n expression(queryText: string): WixDataSearch\n\n /**\n * Enables fuzzy search for approximate text matching.\n *\n * The `fuzzy()` method enables fuzzy search, which allows for approximate matches of the search expression. When fuzzy search is enabled, the search will return results that closely match the search expression even if they don't exactly match.\n *\n * @returns The current WixDataSearch instance for method chaining.\n */\n fuzzy(): WixDataSearch\n\n /**\n * Sets the search mode to **AND** for expression terms.\n *\n * When in **AND** mode, all specified search term or filter conditions must be present for an item to be included in the results. For example, with expression \"red car\" in AND mode, only items that include both \"red\" and \"car\" are included in the results.\n *\n * @returns Current WixDataSearch object.\n */\n andMode(): WixDataSearch\n\n /**\n * Sets the search mode to **OR** for expression terms.\n *\n * When in **OR** mode, an item is included in the results if it contains any of the specified search terms in the expression.\n *\n * For example, with expression \"red car\" in **OR** mode, items that include either \"red\" or \"car\" (or both) are included in the results.\n *\n * @returns Current WixDataSearch object.\n */\n orMode(): WixDataSearch\n\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` 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 may not reflect recent changes.\n * @param options - Configuration options for building the search operation.\n * @returns A Promise that resolves to a WixDataResult 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 in descending order of the specified fields.\n * 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 property 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 property 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 The current WixDataSearch instance, refined with the specified sort order.\n */\n descending(...fields: string[]): WixDataSearch\n /**\n * @param fields - An array of fields to sort by in descending order.\n * @returns The current WixDataSearch instance, refined with the specified sort order.\n */\n descending(fields: string[]): WixDataSearch\n /**\n * @param fields - Fields used in the sort.\n * @returns The current WixDataSearch instance, refined with the specified sort order.\n */\n descending(...fields: any): WixDataSearch\n\n /**\n * Sorts search results by the specified fields in ascending order.\n *\n * The `ascending()` method refines the search to sort results in ascending order of the specified fields.\n * 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 after `\"XYZ\"`.\n * - **Reference**: Compares by the ID of the referenced item as a String.\n *\n * If a property 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 property 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 The current WixDataSearch instance, refined with the specified sort order.\n */\n ascending(...fields: string[]): WixDataSearch\n /**\n * @param fields - An array of fields to sort by in ascending order.\n * @returns The current WixDataSearch instance, refined with the specified sort order.\n */\n ascending(fields: string[]): WixDataSearch\n /**\n * @param fields - Fields used in the sort.\n * @returns The current WixDataSearch instance, refined with the specified sort order.\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`. The method 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 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 Current WixDataSearch object, refined with the equality filter.\n */\n eq(field: string, value: any): WixDataSearch\n\n /**\n * Refines a search to match items whose specified property value does not equal the specified value.\n *\n * The `ne()` method refines this search to only\n * match items where the value of the specified property does not equal the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * 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 the `field` property is an array, `ne()` includes items\n * 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 The current WixDataSearch instance, refined with the inequality filter.\n */\n ne(field: string, value: any): WixDataSearch\n\n /**\n * Refines a search to match items whose specified property value is greater than or equal to the specified\n * value.\n *\n * The `ge()` method refines this search to only\n * match items where the value of the specified property is greater than or\n * 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 property 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 property are ranked lowest.\n *\n * The following types of properties can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically,\n * so `\"abc\"` is greater than or equal to `\"ABC\"` (because of the greater than),\n * 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 The current WixDataSearch instance, refined with the 'greater than or equal' filter.\n */\n ge(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items whose specified property value is greater than the specified value.\n *\n * The `gt()` method refines this search to only match\n * items where the value of the specified property is greater than 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 property 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 property are ranked lowest.\n *\n * The following types of properties 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 The current WixDataSearch instance, refined with the 'greater than' filter.\n */\n gt(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items whose specified property value is less than or equal to the specified\n * value.\n *\n * The `le()` method refines this search to only match\n * items where the value of the specified property is less than or equal to the\n * 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 property 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 property are ranked lowest.\n *\n * The following types of properties can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically,\n * so `\"ABC\"` is less than or equal to `\"abc\"` (because of the less than),\n * 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 against.\n * @requiredField value\n * @returns The current WixDataSearch instance, refined with the 'less than or equal' filter.\n */\n le(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items whose specified property value is less than the specified value.\n *\n * The `lt()` method refines this search to only match\n * items where the value of the specified property is less than 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 property 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 property are ranked lowest.\n *\n * The following types of properties 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 against.\n * @requiredField value\n * @returns The current WixDataSearch instance, refined with the 'less than' filter.\n */\n lt(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items whose specified property has any value (is not null or undefined).\n *\n * The `isNotEmpty()` method refines this search to only match items where the\n * value of the specified property is not `null` or `undefined`.\n *\n * If the property contains any value at all for a given item, including the\n * empty string or an invalid value, that item will match 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 The current WixDataSearch instance, refined with the 'is not empty' filter.\n */\n isNotEmpty(field: string): WixDataSearch\n\n /**\n * Refines a search to match items whose specified property does not exist or does not have any value (is null or undefined).\n *\n * The `isEmpty()` method refines this search to only match items where the\n * value of the specified property is `null` or `undefined` or the property does\n * not exist.\n *\n * If the property contains any value at all for a given item, including the\n * empty string or an invalid value, that item will 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 The current WixDataSearch instance, refined with the 'is empty' filter.\n */\n isEmpty(field: string): WixDataSearch\n\n /**\n * Refines a search to match items whose specified property value starts with a specified string.\n *\n * The `startsWith()` method refines this search to\n * only match items where the value of the specified property starts with the\n * defined `string`. Matching with `startsWith()` is not case sensitive, so `\"TEXT\"` starts\n * with `\"tex\"`.\n *\n * You can only use `startsWith()` with a property whose value is a String or Reference.\n * When using a Reference, `startsWith()` matches by the ID of the referenced item as Strings.\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 property value.\n * @requiredField value\n * @returns The current `WixDataSearch` instance, refined with the 'starts with' filter.\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 `value` parameters.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param values - Values to match.\n * @requiredField values\n * @returns The current WixDataSearch instance, refined with the 'has some' filter.\n */\n hasSome(field: string, ...values: string[] | number[] | Date[]): WixDataSearch\n\n /**\n * Overload for `hasSome()`. Refines a search to match items whose specified property 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 The current WixDataSearch instance, refined with the 'has some' filter.\n */\n hasSome(field: string, values: string[] | number[] | Date[]): WixDataSearch\n\n /**\n * Refines a search to match items whose specified property values equals all of the specified `value`\n * parameters.\n *\n * The `hasAll()` method refines this search to\n * only match items where the value of the specified property equals all of\n * 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 property is an array, `hasAll()` will match\n * if there is a match in the elements of that array for all of the specified\n * values.\n *\n * You can specify a list of values to match by providing an array of\n * String, Number, or Date types as the `value` parameters.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param values - Values to match. All specified values must be present.\n * @requiredField values\n * @returns The current WixDataSearch instance, refined with the 'has all' filter.\n */\n hasAll(field: string, ...values: string[] | number[] | Date[]): WixDataSearch\n\n /**\n * Overload for `hasAll()`. Refines a search to match items whose specified property 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 - An array of values to match. All values in the array must be present.\n * @requiredField values\n * @returns The current WixDataSearch instance, refined with the 'has all' filter.\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 this 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 is designed to work with 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 The current WixDataSearch instance, refined with the 'or' condition.\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 the filter as defined up to the `and()` method, as well as 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, this search returns results whose status is active **and** age is greater than 25:\n *\n * ```javascript\n * wixData.search(\"myCollection\").expression(\"some text\").eq(\"status\", \"active\").gt(\"age\", 25);\n * ```\n *\n * The `and()` method is needed when performing 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 = wixData.filter().eq(\"status\", \"pending\").or(wixData.filter().eq(\"status\", \"rejected\"));\n *\n * let ageFilter = wixData.filter().lt(\"age\", 25).or(wixData.filter().gt(\"age\", 65));\n *\n * let finalSearch = wixData.search(\"myCollection\").expression(\"some text\").and(statusFilter).and(ageFilter);\n * ```\n *\n * > **Note**: The `and()` method is designed to work with 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 The current WixDataSearch instance, refined with the 'and' condition.\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 The current WixDataSearch instance, refined with the 'not' condition.\n */\n not(filter: WixDataFilter): WixDataSearch\n\n /**\n * Refines a search to match items whose specified property value is within a specified range.\n *\n * The `between()` method refines this search to only match items where the value of the specified property is\n * 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\n * same number stored as a Number type.\n *\n * If a property contains a number as a String, that value is compared alphabetically and not numerically. Items\n * that do not have a value for the specified property are ranked lowest.\n *\n * The following types of properties 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 The current WixDataSearch instance, refined with the 'between' filter.\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 a search's results.\n *\n * The `fields()` method specifies which fields to return in the search results.\n *\n * You can use `include()` in conjunction with `fields()` to get referenced items.\n *\n * When `fields()` receives an empty or invalid property, 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 - Properties to return.\n * @requiredField fields\n * @returns The current `WixDataSearch` instance, configured to return specified fields.\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 returns in each\n * page. Only one page of results is retrieved at a time. The `next()`\n * and `prev()` methods of the `WixDataResult` object are used to\n * 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 The current `WixDataSearch` instance, refined with the specified limit.\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\n * results before returning new search results.\n *\n * For example, if your search matches 50 items, but\n * you set `skip` to 10, the results returned will skip the first 10 items\n * 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 in the search results before returning the results.\n * @requiredField skipCount\n * @returns The current `WixDataSearch` instance, refined with the specified skip count.\n */\n skip(skipCount: number): WixDataSearch\n\n /**\n * Includes referenced items for the specified properties in a search's results.\n *\n * The `include()` method refines a search so that the items returned in the\n * search's results include the full referenced items for the specified properties.\n *\n * For example, suppose you have a **books** collection with an **author**\n * field that references an **authors** collection. Searching the **books**\n * collection with an `include(\"author\")` returns the relevant book items\n * and each item will include the full referenced author item in the book's\n * `author` property.\n *\n * When searching a collection that contains a reference field without using the\n * `include()` method:\n * - Single reference field: returned items contain only the ID of the\n * referenced item, and not the full referenced items.\n * - Multiple reference field: returned items do not contain the multiple\n * reference field at all.\n *\n * When including a property with multiple references, the following limitations\n * apply:\n * - Only one property with multiple references can be included.\n * - The search will return an error if more than 50 items are returned, regardless\n * of any search limit set using the `limit()` method.\n * - Each returned item can include up to 50 referenced items. If there are more\n * than 50 referenced items, only 50 are returned when the search is run\n * and the `partialIncludes` property 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 The current `WixDataSearch` instance, configured to include referenced items.\n */\n include(...fields: string[]): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified property 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 The current `WixDataSearch` instance.\n */\n include(field: string, limit?: number): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified properties 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 The current `WixDataSearch` instance.\n */\n include(field1: string, field2: string, limit?: number): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified properties 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 The current `WixDataSearch` instance.\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 properties 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 The current `WixDataSearch` instance.\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 properties 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 The current `WixDataSearch` instance.\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 properties in a search's results.\n * Allows specifying multiple field names and an optional limit.\n * @public\n * @documentationMaturity preview\n * @param fieldNamesAndLimit - An array of field names, optionally followed by a limit number.\n * @returns The current `WixDataSearch` instance.\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 for 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 for across all fields in the collection.\n * @returns Current WixDataSearch object for method chaining.\n */\n expression(queryText: string): WixDataSearch\n\n /**\n * Enables fuzzy search for approximate text matching.\n *\n * The `fuzzy()` method enables fuzzy search, which allows for approximate matches of the search expression. When fuzzy search is enabled, the search will return results that closely match the search expression even if they don't exactly match.\n *\n * @returns The current WixDataSearch instance for method chaining.\n */\n fuzzy(): WixDataSearch\n\n /**\n * Sets the search mode to **AND** for expression terms.\n *\n * When in **AND** mode, all specified search term or filter conditions must be present for an item to be included in the results. For example, with expression \"red car\" in AND mode, only items that include both \"red\" and \"car\" are included in the results.\n *\n * @returns Current WixDataSearch object.\n */\n andMode(): WixDataSearch\n\n /**\n * Sets the search mode to **OR** for expression terms.\n *\n * When in **OR** mode, an item is included in the results if it contains any of the specified search terms in the expression.\n *\n * For example, with expression \"red car\" in **OR** mode, items that include either \"red\" or \"car\" (or both) are included in the results.\n *\n * @returns Current 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` 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 may not reflect recent changes.\n * @param options - Configuration options for building the search operation.\n * @returns A Promise that resolves to a WixDataResult 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 in descending order of the specified fields.\n * 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 property 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 property 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 The current WixDataSearch instance, refined with the specified sort order.\n */\n descending(...fields: string[]): WixDataSearch\n /**\n * @param fields - An array of fields to sort by in descending order.\n * @returns The current WixDataSearch instance, refined with the specified sort order.\n */\n descending(fields: string[]): WixDataSearch\n /**\n * @param fields - Fields used in the sort.\n * @returns The current WixDataSearch instance, refined with the specified sort order.\n */\n descending(...fields: any): WixDataSearch\n\n /**\n * Sorts search results by the specified fields in ascending order.\n *\n * The `ascending()` method refines the search to sort results in ascending order of the specified fields.\n * 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 after `\"XYZ\"`.\n * - **Reference**: Compares by the ID of the referenced item as a String.\n *\n * If a property 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 property 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 The current WixDataSearch instance, refined with the specified sort order.\n */\n ascending(...fields: string[]): WixDataSearch\n /**\n * @param fields - An array of fields to sort by in ascending order.\n * @returns The current WixDataSearch instance, refined with the specified sort order.\n */\n ascending(fields: string[]): WixDataSearch\n /**\n * @param fields - Fields used in the sort.\n * @returns The current WixDataSearch instance, refined with the specified sort order.\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`. The method 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 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 Current WixDataSearch object, refined with the equality filter.\n */\n eq(field: string, value: any): WixDataSearch\n\n /**\n * Refines a search to match items whose specified property value does not equal the specified value.\n *\n * The `ne()` method refines this search to only\n * match items where the value of the specified property does not equal the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * 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 the `field` property is an array, `ne()` includes items\n * 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 The current WixDataSearch instance, refined with the inequality filter.\n */\n ne(field: string, value: any): WixDataSearch\n\n /**\n * Refines a search to match items whose specified property value is greater than or equal to the specified\n * value.\n *\n * The `ge()` method refines this search to only\n * match items where the value of the specified property is greater than or\n * 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 property 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 property are ranked lowest.\n *\n * The following types of properties can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically,\n * so `\"abc\"` is greater than or equal to `\"ABC\"` (because of the greater than),\n * 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 The current WixDataSearch instance, refined with the 'greater than or equal' filter.\n */\n ge(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items whose specified property value is greater than the specified value.\n *\n * The `gt()` method refines this search to only match\n * items where the value of the specified property is greater than 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 property 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 property are ranked lowest.\n *\n * The following types of properties 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 The current WixDataSearch instance, refined with the 'greater than' filter.\n */\n gt(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items whose specified property value is less than or equal to the specified\n * value.\n *\n * The `le()` method refines this search to only match\n * items where the value of the specified property is less than or equal to the\n * 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 property 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 property are ranked lowest.\n *\n * The following types of properties can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically,\n * so `\"ABC\"` is less than or equal to `\"abc\"` (because of the less than),\n * 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 against.\n * @requiredField value\n * @returns The current WixDataSearch instance, refined with the 'less than or equal' filter.\n */\n le(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items whose specified property value is less than the specified value.\n *\n * The `lt()` method refines this search to only match\n * items where the value of the specified property is less than 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 property 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 property are ranked lowest.\n *\n * The following types of properties 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 against.\n * @requiredField value\n * @returns The current WixDataSearch instance, refined with the 'less than' filter.\n */\n lt(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items whose specified property has any value (is not null or undefined).\n *\n * The `isNotEmpty()` method refines this search to only match items where the\n * value of the specified property is not `null` or `undefined`.\n *\n * If the property contains any value at all for a given item, including the\n * empty string or an invalid value, that item will match 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 The current WixDataSearch instance, refined with the 'is not empty' filter.\n */\n isNotEmpty(field: string): WixDataSearch\n\n /**\n * Refines a search to match items whose specified property does not exist or does not have any value (is null or undefined).\n *\n * The `isEmpty()` method refines this search to only match items where the\n * value of the specified property is `null` or `undefined` or the property does\n * not exist.\n *\n * If the property contains any value at all for a given item, including the\n * empty string or an invalid value, that item will 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 The current WixDataSearch instance, refined with the 'is empty' filter.\n */\n isEmpty(field: string): WixDataSearch\n\n /**\n * Refines a search to match items whose specified property value starts with a specified string.\n *\n * The `startsWith()` method refines this search to\n * only match items where the value of the specified property starts with the\n * defined `string`. Matching with `startsWith()` is case-sensitive, so `\"TEXT\"` does not start\n * with `\"tex\"`.\n *\n * You can only use `startsWith()` with a property whose value is a String or Reference.\n * When using a Reference, `startsWith()` matches by the ID of the referenced item as Strings.\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 property value.\n * @requiredField value\n * @returns The current `WixDataSearch` instance, refined with the 'starts with' filter.\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 `value` parameters.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param values - Values to match.\n * @requiredField values\n * @returns The current WixDataSearch instance, refined with the 'has some' filter.\n */\n hasSome(field: string, ...values: string[] | number[] | Date[]): WixDataSearch\n\n /**\n * Overload for `hasSome()`. Refines a search to match items whose specified property 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 The current WixDataSearch instance, refined with the 'has some' filter.\n */\n hasSome(field: string, values: string[] | number[] | Date[]): WixDataSearch\n\n /**\n * Refines a search to match items whose specified property values equals all of the specified `value`\n * parameters.\n *\n * The `hasAll()` method refines this search to\n * only match items where the value of the specified property equals all of\n * 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 property is an array, `hasAll()` will match\n * if there is a match in the elements of that array for all of the specified\n * values.\n *\n * You can specify a list of values to match by providing an array of\n * String, Number, or Date types as the `value` parameters.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param values - Values to match. All specified values must be present.\n * @requiredField values\n * @returns The current WixDataSearch instance, refined with the 'has all' filter.\n */\n hasAll(field: string, ...values: string[] | number[] | Date[]): WixDataSearch\n\n /**\n * Overload for `hasAll()`. Refines a search to match items whose specified property 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 - An array of values to match. All values in the array must be present.\n * @requiredField values\n * @returns The current WixDataSearch instance, refined with the 'has all' filter.\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 this 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 is designed to work with 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 The current WixDataSearch instance, refined with the 'or' condition.\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 the filter as defined up to the `and()` method, as well as 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, this search returns results whose status is active **and** age is greater than 25:\n *\n * ```javascript\n * items.search(\"myCollection\").expression(\"some text\").eq(\"status\", \"active\").gt(\"age\", 25);\n * ```\n *\n * The `and()` method is needed when performing 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.filter().eq(\"status\", \"pending\").or(items.filter().eq(\"status\", \"rejected\"));\n *\n * let ageFilter = items.filter().lt(\"age\", 25).or(items.filter().gt(\"age\", 65));\n *\n * let finalSearch = items.search(\"myCollection\").expression(\"some text\").and(statusFilter).and(ageFilter);\n * ```\n *\n * > **Note**: The `and()` method is designed to work with 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 The current WixDataSearch instance, refined with the 'and' condition.\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 The current WixDataSearch instance, refined with the 'not' condition.\n */\n not(filter: WixDataFilter): WixDataSearch\n\n /**\n * Refines a search to match items whose specified property value is within a specified range.\n *\n * The `between()` method refines this search to only match items where the value of the specified property is\n * 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\n * same number stored as a Number type.\n *\n * If a property contains a number as a String, that value is compared alphabetically and not numerically. Items\n * that do not have a value for the specified property are ranked lowest.\n *\n * The following types of properties 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 The current WixDataSearch instance, refined with the 'between' filter.\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 a search's results.\n *\n * The `fields()` method specifies which fields to return in the search results.\n *\n * You can use `include()` in conjunction with `fields()` to get referenced items.\n *\n * When `fields()` receives an empty or invalid property, 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 - Properties to return.\n * @requiredField fields\n * @returns The current `WixDataSearch` instance, configured to return specified fields.\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 returns in each\n * page. Only one page of results is retrieved at a time. The `next()`\n * and `prev()` methods of the `WixDataResult` object are used to\n * 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 The current `WixDataSearch` instance, refined with the specified limit.\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\n * results before returning new search results.\n *\n * For example, if your search matches 50 items, but\n * you set `skip` to 10, the results returned will skip the first 10 items\n * 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 in the search results before returning the results.\n * @requiredField skipCount\n * @returns The current `WixDataSearch` instance, refined with the specified skip count.\n */\n skip(skipCount: number): WixDataSearch\n\n /**\n * Includes referenced items for the specified properties in a search's results.\n *\n * The `include()` method refines a search so that the items returned in the\n * search's results include the full referenced items for the specified properties.\n *\n * For example, suppose you have a **books** collection with an **author**\n * field that references an **authors** collection. Searching the **books**\n * collection with an `include(\"author\")` returns the relevant book items\n * and each item will include the full referenced author item in the book's\n * `author` property.\n *\n * When searching a collection that contains a reference field without using the\n * `include()` method:\n * - Single reference field: returned items contain only the ID of the\n * referenced item, and not the full referenced items.\n * - Multiple reference field: returned items do not contain the multiple\n * reference field at all.\n *\n * When including a property with multiple references, the following limitations\n * apply:\n * - Only one property with multiple references can be included.\n * - The search will return an error if more than 50 items are returned, regardless\n * of any search limit set using the `limit()` method.\n * - Each returned item can include up to 50 referenced items. If there are more\n * than 50 referenced items, only 50 are returned when the search is run\n * and the `partialIncludes` property 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 The current `WixDataSearch` instance, configured to include referenced items.\n */\n include(...fields: string[]): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified property 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 The current `WixDataSearch` instance.\n */\n include(field: string, limit?: number): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified properties 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 The current `WixDataSearch` instance.\n */\n include(field1: string, field2: string, limit?: number): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified properties 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 The current `WixDataSearch` instance.\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 properties 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 The current `WixDataSearch` instance.\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 properties 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 The current `WixDataSearch` instance.\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 properties in a search's results.\n * Allows specifying multiple field names and an optional limit.\n * @public\n * @documentationMaturity preview\n * @param fieldNamesAndLimit - An array of field names, optionally followed by a limit number.\n * @returns The current `WixDataSearch` instance.\n */\n include(...fieldNamesAndLimit: [...string[], number]): WixDataSearch\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -43,7 +43,6 @@ export interface WixDataSearch {
|
|
|
43
43
|
*/
|
|
44
44
|
orMode(): WixDataSearch;
|
|
45
45
|
/**
|
|
46
|
-
* *
|
|
47
46
|
* Runs the search operation.
|
|
48
47
|
*
|
|
49
48
|
* The `run()` method searches the collection for the specified expression. It returns a Promise that resolves to a `WixDataResult` that contains the matching items and search metadata.
|
|
@@ -309,7 +308,7 @@ export interface WixDataSearch {
|
|
|
309
308
|
*
|
|
310
309
|
* The `startsWith()` method refines this search to
|
|
311
310
|
* only match items where the value of the specified property starts with the
|
|
312
|
-
* defined `string`. Matching with `startsWith()` is
|
|
311
|
+
* defined `string`. Matching with `startsWith()` is case-sensitive, so `"TEXT"` does not start
|
|
313
312
|
* with `"tex"`.
|
|
314
313
|
*
|
|
315
314
|
* You can only use `startsWith()` with a property whose value is a String or Reference.
|
|
@@ -412,17 +411,17 @@ export interface WixDataSearch {
|
|
|
412
411
|
* When chaining multiple filter methods to a search, an `and` condition is often assumed by default. For example, this search returns results whose status is active **and** age is greater than 25:
|
|
413
412
|
*
|
|
414
413
|
* ```javascript
|
|
415
|
-
*
|
|
414
|
+
* items.search("myCollection").expression("some text").eq("status", "active").gt("age", 25);
|
|
416
415
|
* ```
|
|
417
416
|
*
|
|
418
417
|
* The `and()` method is needed when performing 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:
|
|
419
418
|
*
|
|
420
419
|
* ```javascript
|
|
421
|
-
* let statusFilter =
|
|
420
|
+
* let statusFilter = items.filter().eq("status", "pending").or(items.filter().eq("status", "rejected"));
|
|
422
421
|
*
|
|
423
|
-
* let ageFilter =
|
|
422
|
+
* let ageFilter = items.filter().lt("age", 25).or(items.filter().gt("age", 65));
|
|
424
423
|
*
|
|
425
|
-
* let finalSearch =
|
|
424
|
+
* let finalSearch = items.search("myCollection").expression("some text").and(statusFilter).and(ageFilter);
|
|
426
425
|
* ```
|
|
427
426
|
*
|
|
428
427
|
* > **Note**: The `and()` method is designed to work with 2 or more filters.
|
|
@@ -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;;;;;;;OAOG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,CAAA;IAE5C;;;;;;OAMG;IACH,KAAK,IAAI,aAAa,CAAA;IAEtB;;;;;;OAMG;IACH,OAAO,IAAI,aAAa,CAAA;IAExB;;;;;;;;OAQG;IACH,MAAM,IAAI,aAAa,CAAA;IAEvB
|
|
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;;;;;;;OAOG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,CAAA;IAE5C;;;;;;OAMG;IACH,KAAK,IAAI,aAAa,CAAA;IAEtB;;;;;;OAMG;IACH,OAAO,IAAI,aAAa,CAAA;IAExB;;;;;;;;OAQG;IACH,MAAM,IAAI,aAAa,CAAA;IAEvB;;;;;;;;OAQG;IACH,GAAG,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;IAEzD;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,UAAU,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,CAAA;IA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ACH,OAAO,CAAC,GAAG,kBAAkB,EAAE,CAAC,GAAG,MAAM,EAAE,EAAE,MAAM,CAAC,GAAG,aAAa,CAAA;CACrE"}
|
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.161",
|
|
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.158",
|
|
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": "a8490e8b8489b5c728f028eb6b7905c3e769d89b2e1c713958e8d6e0"
|
|
89
89
|
}
|