|
| 1 | +To specify a collation for your operation, pass an ``$options`` array |
| 2 | +parameter that sets the ``collation`` option to the operation method. |
| 3 | +Assign the ``collation`` option to an array that configures the collation |
| 4 | +rules. |
| 5 | + |
| 6 | +The following table describes the fields you can set to configure |
| 7 | +the collation: |
| 8 | + |
| 9 | +.. list-table:: |
| 10 | + :widths: 30 70 |
| 11 | + :header-rows: 1 |
| 12 | + |
| 13 | + * - Field |
| 14 | + - Description |
| 15 | + |
| 16 | + * - ``locale`` |
| 17 | + - | *(Required)* Specifies the International Components for Unicode (ICU) locale. For a |
| 18 | + list of supported locales, see :manual:`Collation Locales and Default Parameters |
| 19 | + </reference/collation-locales-defaults/#supported-languages-and-locales>` |
| 20 | + in the {+mdb-server+} Manual. |
| 21 | + |
| 22 | + * - ``caseLevel`` |
| 23 | + - | *(Optional)* Specifies whether to include case comparison. |
| 24 | + | |
| 25 | + | When set to ``true``, the comparison behavior depends on the value of |
| 26 | + the ``strength`` field: |
| 27 | + | |
| 28 | + | - If ``strength`` is ``1``, the {+library-short+} compares base |
| 29 | + characters and case. |
| 30 | + | - If ``strength`` is ``2``, the {+library-short+} compares base |
| 31 | + characters, diacritics, other secondary differences, and case. |
| 32 | + | - If ``strength`` is any other value, this field is ignored. |
| 33 | + | |
| 34 | + | When set to ``false``, the {+library-short+} doesn't include case comparison at |
| 35 | + strength level ``1`` or ``2``. |
| 36 | + | |
| 37 | + | **Data Type**: {+bool-data-type+} |
| 38 | + | **Default**: ``false`` |
| 39 | +
|
| 40 | + * - ``caseFirst`` |
| 41 | + - | *(Optional)* Specifies the sort order of case differences during tertiary |
| 42 | + level comparisons. |
| 43 | + | |
| 44 | + | **Data Type**: {+string-data-type+} |
| 45 | + | **Default**: ``"off"`` |
| 46 | +
|
| 47 | + * - ``strength`` |
| 48 | + - | *(Optional)* Specifies the level of comparison to perform, as defined in the |
| 49 | + `ICU documentation <https://unicode-org.github.io/icu/userguide/collation/concepts.html#comparison-levels>`__. |
| 50 | + | |
| 51 | + | **Data Type**: {+int-data-type+} |
| 52 | + | **Default**: ``3`` |
| 53 | +
|
| 54 | + * - ``numericOrdering`` |
| 55 | + - | *(Optional)* Specifies whether the driver compares numeric strings as numbers. |
| 56 | + | |
| 57 | + | If set to ``true``, the {+library-short+} compares numeric strings as numbers. |
| 58 | + For example, when comparing the strings "10" and "2", the library uses the |
| 59 | + strings' numeric values and treats "10" as greater than "2". |
| 60 | + | |
| 61 | + | If set to ``false``, the {+library-short+} compares numeric strings |
| 62 | + as strings. For example, when comparing the strings "10" and "2", the library |
| 63 | + compares one character at a time and treats "10" as less than "2". |
| 64 | + | |
| 65 | + | For more information, see :manual:`Collation Restrictions </reference/collation/#restrictions>` |
| 66 | + in the {+mdb-server+} manual. |
| 67 | + | |
| 68 | + | **Data Type**: {+bool-data-type+} |
| 69 | + | **Default**: ``false`` |
| 70 | +
|
| 71 | + * - ``alternate`` |
| 72 | + - | *(Optional)* Specifies whether the library considers whitespace and punctuation as base |
| 73 | + characters for comparison purposes. |
| 74 | + | |
| 75 | + | **Data Type**: {+string-data-type+} |
| 76 | + | **Default**: ``"non-ignorable"`` |
| 77 | +
|
| 78 | + * - ``maxVariable`` |
| 79 | + - | *(Optional)* Specifies which characters the library considers ignorable when |
| 80 | + the ``alternate`` field is set to ``"shifted"``. |
| 81 | + | |
| 82 | + | **Data Type**: {+string-data-type+} |
| 83 | + | **Default**: ``"punct"`` |
| 84 | +
|
| 85 | + * - ``backwards`` |
| 86 | + - | *(Optional)* Specifies whether strings containing diacritics sort from the back of the string |
| 87 | + to the front. |
| 88 | + | |
| 89 | + | **Data Type**: {+bool-data-type+} |
| 90 | + | **Default**: ``false`` |
| 91 | +
|
| 92 | +To learn more about collation, see the :manual:`Collation </reference/collation>` |
| 93 | +entry in the {+mdb-server+} manual. |
0 commit comments