diff --git a/i18n/es/docusaurus-plugin-content-docs/current/API/DataClassClass.md b/i18n/es/docusaurus-plugin-content-docs/current/API/DataClassClass.md index fca6069716f85e..d83668efbea10c 100644 --- a/i18n/es/docusaurus-plugin-content-docs/current/API/DataClassClass.md +++ b/i18n/es/docusaurus-plugin-content-docs/current/API/DataClassClass.md @@ -1222,11 +1222,11 @@ Si *attributePath* designa un atributo que almacena [**objetos vectores**](../AP En este caso, el parámetro *value* debe ser un **objeto vectorial de comparación** que contenga las siguientes propiedades: -| Propiedad | Tipo | Descripción | -| --------- | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| vector | [4D.Vector](../API/VectorClass.md) | Obligatorio. El vector a comparar | -| metric | Text | Opcional. [Cálculo vectorial](../API/VectorClass.md#understanding-the-different-vector-computations) a utilizar para la consulta. Puede utilizar una de las siguientes constantes (Texto)
  • :`mk cosine` (por defecto si se omite): calcula la similaridad en cosenos entre los vectores.
  • `mk dot`: calcula la similaridad en puntos de los vectores.
  • `mk euclidean`: calcula la distancia euclideana entre vectores. | -| threshold | Real | Opcional (por defecto: 0,5). Un valor umbral utilizado para filtrar las comparaciones de vectores en función de su puntuación de similitud coseno, punto o euclídea según la "métrica" seleccionada. Es altamente recomendable elegir una similitud que se adapte mejor a su caso de uso específico para obtener resultados óptimos. | +| Propiedad | Tipo | Descripción | +| --------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| vector | [4D.Vector](../API/VectorClass.md) | Obligatorio. El vector a comparar | +| metric | Text | Opcional. [Cálculo vectorial](../API/VectorClass.md#understanding-the-different-vector-computations) a utilizar para la consulta. You can use one of the following (Text) constants:
  • `mk cosine` (default if omitted): calculates the [cosine similarity](./VectorClass.md#cosinesimilarity) between vectors.
  • `mk dot`: calculates the [dot similarity](VectorClass.md#dotsimilarity) of vectors.
  • `mk euclidean`: calculates the [Euclidean distance](./VectorClass.md#euclideandistance) between vectors. | +| threshold | Real | Opcional (por defecto: 0,5). Un valor umbral utilizado para filtrar las comparaciones de vectores en función de su puntuación de similitud coseno, punto o euclídea según la "métrica" seleccionada. Es altamente recomendable elegir una similitud que se adapte mejor a su caso de uso específico para obtener resultados óptimos. | Sólo se admite un subconjunto de símbolos **comparadores**. Tenga en cuenta que comparan los resultados con el valor umbral: @@ -1241,8 +1241,8 @@ Por ejemplo, se desea devolver entidades de MyClass donde la similaridad con un ```4d var $myVector : 4D.Vector -$myVector := getVector ///método para obtener un vector, por ejemplo a partir de 4D.AIKit -var $comparisonVector := {vector: $myVector; metric: mk euclidean; threshold: 1.2} +$myVector := getVector //method to get a vector, e.g. from 4D.AIKit +var $comparisonVector := {vector: $myVector; metric: mk cosine; threshold: 1.2} var $results := ds.MyClass.query("myVectorField <= :1"; $comparisonVector) ``` @@ -1250,20 +1250,24 @@ La instrucción **orden by** es soportada en la cadena de consulta para que las ```4d var $results := ds.MyClass.query("myVectorField > :1 order by myVectorField desc"; $comparisonVector) - //the first entity is the most similar + //$results.first() entity is the most similar ``` :::note -The default order is ascending, although a descending order is usually the most useful for vector similarity queries. Thus, you will usually have to add the `desc` keyword in your vector similarity query strings. +You will generally want vector similarity query results to be sorted from "most similar" to "least similar." By default, results returned with an **order by** clause are sorted in ascending order. Depending on the similarity metric used, you may need to adjust the sorting direction to obtain the correct ranking: + +- for [**cosine**](./VectorClass.md#cosinesimilarity) and [**dot**](./VectorClass.md#dotsimilarity) similarity, higher values indicate greater similarity. Therefore, you will typically need to include the `desc` keyword in the query string. +- for [**euclidean distance**](./VectorClass.md#euclideandistance) similarity, lower values indicate greater similarity. In this case, the default ascending order (or explicitly using the `asc` keyword) is appropriate. ::: -Si el mismo vector aparece varias veces en la cadena de consulta, el orden por se aplicará a los resultados del primero, por ejemplo: +You can only order on a single vector field. Si el mismo vector aparece varias veces en la cadena de consulta, el orden por se aplicará a los resultados del primero, por ejemplo: ```4d var $results := ds.MyClass.query("myVectorField > :1 and myVectorField > :2 order by myVectorField desc"; / - {vector : $myVector1 };{vector : $myVector2 }) //myVectorField > :1 is used for the order by + {vector : $myVector1 };{vector : $myVector2 }) + //myVectorField > :1 is used for the order by ``` Ver [más ejemplos a continuación](#example-4-2) (ejemplos 4 y 5). @@ -1271,6 +1275,7 @@ Ver [más ejemplos a continuación](#example-4-2) (ejemplos 4 y 5). :::tip Entradas de blog relacionadas - [4D AI: Búsqueda de entidades por similaridad vectorial en 4D](https://blog.4d.com/4d-ai-searching-entities-by-vector-similarity-in-4d) +- [4D AI: Sorting Query Results by Vector Similarity](https://blog.4d.com/4d-ai-sorting-query-results-by-vector-similarity/) - [Por qué su Pila de búsqueda está rota y cómo lo soluciona la búsqueda vectorial](https://blog.4d.com/why-your-search-stack-feels-broken-and-how-vector-search-fixes-it) ::: @@ -1637,31 +1642,29 @@ var $client:=cs.AIKit.OpenAI.new("my api key") var $result:=$client.embeddings.create("my long text to search"; "text-embedding-ada-002") var $vector:=$result.vector - //el atributo embedding se basa en un campo 4D que almacena objetos de clase 4D.Vector - //buscar con la métrica por defecto (coseno) -var $employees:=ds.Employee.query("embedding > :1"; {vector : $vector}) - //buscar con la métrica euclídea -var $employees:=ds.Employee.query("embedding > :1"; {vector: $vector; metric: mk euclidean}) - //búsqueda con métrica coseno explícita y umbral personalizado -var $employees:=ds.Employee.query("embedding > :1"; {vector: $vector; metric: mk cosine; threshold: 0.9}) - //buscar con una fórmula + //embedding attribute is based upon a 4D field storing 4D.Vector class objects + + //search with default metric (cosine) +var $employees:=ds.Employee.query("embedding > :1 order by embedding desc"; {vector : $vector}) + + //search with euclidean metric +var $employees:=ds.Employee.query("embedding < :1 order by embedding"; {vector: $vector; metric: mk euclidean}) + + //search with explicit cosine metric and custom threshold +var $employees:=ds.Employee.query("embedding > :1 order by embedding desc"; {vector: $vector; metric: mk cosine; threshold: 0.9}) + + //search with a formula var $employees:=ds.Employee.query(Formula(This.embdedding.cosineSimilarity($vector)>0.9)) ``` #### Ejemplo 5 -Queremos ejecutar una consulta por similitud vectorial utilizando vectores con diferentes métricas y ordenar los resultados por similaridades de coseno: +Vector-based semantic ordering can be combined with traditional ORDA filters in the same query. ```4d - //Crear los vectores de comparación -var $vector1Comparison:={vector: $myvector; métrica: mk coseno; umbral: 0.4} -var $vector2Comparison:={vector: $myvector; metric: mk euclidean; threshold:1} - - //el atributo embedding se basa en un campo 4D que almacena objetos de clase 4D.Vector -ds.VectorTable.query("embedding>:1 and embedding<:2";$vector1Comparison;$vector2Comparison)\ - .orderByFormula(Formula(This.embedding.cosineSimilarity($vector1Comparison))) - +var $comparisonVector := {vector: $myVector; metric: mk cosine; threshold: 0.4} +var $results := ds.MyTable.query("myVectorField <= :1 AND salary>100000 order by myVectorField, salary desc"; $comparisonVector) ``` #### Ver también diff --git a/i18n/es/docusaurus-plugin-content-docs/current/Notes/updates.md b/i18n/es/docusaurus-plugin-content-docs/current/Notes/updates.md index bac581f36ff95e..e20d414ed43ad3 100644 --- a/i18n/es/docusaurus-plugin-content-docs/current/Notes/updates.md +++ b/i18n/es/docusaurus-plugin-content-docs/current/Notes/updates.md @@ -9,7 +9,8 @@ Lea [**Novedades en 4D 21 R4**](https://blog.4d.com/whats-new-in-4d-21-r4/), la #### Lo más destacado -- New [`defer`](../commands/defer) command to declare some code to be always executed at method or function exit. +- Multi-level list style sheets are now [supported in 4D Write Pro Interface](../WritePro/writeprointerface.md#multi-level-style-sheets), allowing users to create and manage structured multi-level lists directly from the toolbar and sidebar. +- New [`defer`](../commands/defer) command to declare some code to be always executed at method or function exit; new [`Deferred formulas`](../commands/deferred-formulas) command to get the list of deferred formulas. ## 4D 21 R3 @@ -18,7 +19,7 @@ Lea [**Novedades en 4D 21 R3**](https://blog.4d.com/es/whats-new-in-4d-21-r3/), #### Lo más destacado - El comando [`JSON Validate`](../commands/json-validate) ahora es compatible con el borrador 2020-12 del esquema JSON. -- 4D Write Pro now supports [hierarchical list style sheets](../WritePro/user-legacy/stylesheets.md#hierarchical-list-style-sheets), enabling the creation and management of structured [multi-level lists](../WritePro/user-legacy/using-a-4d-write-pro-area.md#multi-level-lists) with automatic numbering. +- 4D Write Pro now supports [multi-level list style sheets](../WritePro/user-legacy/stylesheets.md#multi-level-list-style-sheets), enabling the creation and management of structured [multi-level lists](../WritePro/user-legacy/using-a-4d-write-pro-area.md#multi-level-lists) with automatic numbering. - Ability to use a custom certificate from the macOS keychain instead of a local certificates folder in [`HTTPRequest`](../API/HTTPRequestClass.md#4dhttprequestnew) and [`HTTPAgent`](../API/HTTPAgentClass.md#4dhttpagentnew) classes. - Nueva clase [`4D.Method`](../API/MethodClass.md) para crear y ejecutar un código de método 4D a partir de una fuente de texto. [`METHOD Get path`](../commands/method-get-path) and [`METHOD RESOLVE PATH`](../commands/method-resolve-path) commands support a new `path volatile method` constant (128). - IMAP transporter now supports mailbox event notifications using the IDLE protocol through a [notifier object](../API/IMAPTransporterClass.md#notifier) of the [4D.IMAPNotifier](../API/IMAPNotifierClass.md) class, configurable via the `listener` property of [IMAP New transporter](../commands/imap-new-transporter). diff --git a/i18n/es/docusaurus-plugin-content-docs/current/WritePro/user/user-new.md b/i18n/es/docusaurus-plugin-content-docs/current/WritePro/user/user-new.md index bd6dddcf0bafd3..1a1308503ba939 100644 --- a/i18n/es/docusaurus-plugin-content-docs/current/WritePro/user/user-new.md +++ b/i18n/es/docusaurus-plugin-content-docs/current/WritePro/user/user-new.md @@ -10,7 +10,7 @@ para importar ## Listas -4D Write Pro admite listas planas (de un solo nivel) y listas jerárquicas (de varios niveles). +4D Write Pro supports flat lists (single-level) and multi-level lists. ### Listas de un solo nivel @@ -39,7 +39,7 @@ When the list is created using [the WP SET ATTRIBUTE command](../commands-legacy ### Listas de múltiples niveles -Multi-level lists are based on [hierarchical list style sheets](../user-legacy/stylesheets.md#hierarchical-list-style-sheets). Las listas multinivel contienen una hoja de estilo de nivel raíz y una o más hojas de estilo de subnivel. Cada nivel se adjunta a una hoja de estilo de lista jerárquica y representa una profundidad en la lista (nivel 1, nivel 2, nivel 3, etc.). +Multi-level lists are based on [multi-level list style sheets](../user-legacy/stylesheets.md#multi-level-list-style-sheets). Las listas multinivel contienen una hoja de estilo de nivel raíz y una o más hojas de estilo de subnivel. Each level is attached to a multi-level list style sheet and represents a depth in the list (level 1, level 2, level 3, etc.). Cuando se crea un nuevo subnivel, la numeración de niveles vuelve a empezar en 1. Cuando añade o elimina un elemento en su lista de nivel múltiple, los números se ajustan automáticamente. @@ -55,30 +55,30 @@ Listas de varios niveles pueden ser gestionadas usando: :::tip Entrada de blog relacionada -[4D Write Pro – Creating Multi-level Bullet or Numbered Lists Using Hierarchical list Style Sheets](https://blog.4d.com/4d-write-pro-creating-multi-level-bullet-or-numbered-lists-using-hierarchical-paragraph-style-sheets) +[4D Write Pro – Creating Multi-level Bullet or Numbered Lists Using Multi-level list Style Sheets](https://blog.4d.com/4d-write-pro-creating-multi-level-bullet-or-numbered-lists-using-multi-level-paragraph-style-sheets) ::: - + -## Hojas de estilo de listas jerárquicas +## Multi-level list style sheets -Las hojas de estilo de listas jerárquicas se utilizan para crear [listas multinivel](../user-legacy/using-a-4d-write-pro-area.md#multi-level-lists). +Multi-level list style sheets are used to create [multi-level lists](../user-legacy/using-a-4d-write-pro-area.md#multi-level-lists). -To create a hierarchical list style sheet, use [WP New style sheet](../commands/wp-new-style-sheet.md) and pass in *listLevelCount* the desired number of levels. You then define a hierarchy of related paragraph style sheets: one **root-level** style sheet and one or more **sub-level** style sheets linked to it. Cada nivel representa una profundidad en la lista (nivel 1, nivel 2, nivel 3, etc.) and is automatically named "root-level name + lvl + index", for example "Mylist lvl 2". +To create a multi-level list style sheet, use [WP New style sheet](../commands/wp-new-style-sheet.md) and pass in *listLevelCount* the desired number of levels. You then define a hierarchy of related paragraph style sheets: one **root-level** style sheet and one or more **sub-level** style sheets linked to it. Cada nivel representa una profundidad en la lista (nivel 1, nivel 2, nivel 3, etc.) and is automatically named "root-level name + lvl + index", for example "Mylist lvl 2". -To customize hierarchical list styles, the paragraph style sheet object can be customized using [style sheet attributes](../commands-legacy/4d-write-pro-attributes.md#style-sheets). +To customize multi-level list styles, the paragraph style sheet object can be customized using [style sheet attributes](../commands-legacy/4d-write-pro-attributes.md#style-sheets). -Hierarchical list style sheets are fully supported by the following commands: [`WP Get style sheet`](../commands/wp-get-style-sheet.md), [`WP SET ATTRIBUTES`](../commands/wp-set-attributes.md), [`WP DELETE STYLE SHEET`](../commands/wp-delete-style-sheet.md). +Multi-level list style sheets are fully supported by the following commands: [`WP Get style sheet`](../commands/wp-get-style-sheet.md), [`WP SET ATTRIBUTES`](../commands/wp-set-attributes.md), [`WP DELETE STYLE SHEET`](../commands/wp-delete-style-sheet.md). ### Ejemplo -El siguiente ejemplo crea una hoja de estilo de lista jerárquica de tres niveles y la aplica a los párrafos. +The following example creates a three-level multi-level list style sheet and applies it to paragraphs. ```4d -// Create 3 hierarchical list style sheets +// Create 3 multi-level list style sheets WP New style sheet(wpArea; wk type paragraph; "MyList"; 3) // Retrieve each level @@ -92,7 +92,7 @@ WP SET ATTRIBUTES($level1; {listStyleType: wk upper latin; fontBold: wk true}) WP SET ATTRIBUTES($level2; {listConcatStringFormat: True}) WP SET ATTRIBUTES($level3; {listStringFormatLtr: "(#)"}) -// Apply hierarchical style sheets to paragraphs +// Apply multi-level style sheets to paragraphs var $paragraphs : Collection $paragraphs:=WP Get elements(wpArea; wk type paragraph) @@ -103,7 +103,7 @@ WP SET ATTRIBUTES($paragraphs[2]; wk style sheet; $level3) resultado: -![](../../assets/en/WritePro/hierarchical-paragraph-stylesheets-1.png) +![](../../assets/en/WritePro/multi-level-paragraph-stylesheets-1.png) To delete the first sub-leve: @@ -113,11 +113,11 @@ WP DELETE STYLE SHEET(wpArea; "MyList"; 2) resultado: -![](../../assets/en/WritePro/hierarchical-paragraph-stylesheets-2.png) +![](../../assets/en/WritePro/multi-level-paragraph-stylesheets-2.png) ### Predefined attribute values -Cuando se crean, las hojas de estilo de listas jerárquicas utilizan valores predefinidos: +When created, multi-level list style sheets use predefined values: - `wk margin left` = 0,75 cm \* (número de niveles anteriores) o 0,25 pulgadas \* (número de niveles anteriores), dependiendo de la unidad de diseño actual - `wk list type` = `wk decimal` diff --git a/i18n/es/docusaurus-plugin-content-docs/current/WritePro/writeprointerface.md b/i18n/es/docusaurus-plugin-content-docs/current/WritePro/writeprointerface.md index 2d79923bb01aee..cbf6f720b90f53 100644 --- a/i18n/es/docusaurus-plugin-content-docs/current/WritePro/writeprointerface.md +++ b/i18n/es/docusaurus-plugin-content-docs/current/WritePro/writeprointerface.md @@ -1,8 +1,8 @@ ---- +d--- id: writeprointerface -title: Interfaz 4D Write Pro +title: 4D Write Pro Interface slug: /WritePro/write-pro-interface ---- +--------------------------------------------------- 4D Write Pro Interface ofrece un conjunto de paletas, que permiten a los usuarios finales personalizar fácilmente un documento 4D Write Pro. @@ -411,3 +411,154 @@ El área Historial enumera todos los avisos enviados a la IA. Puede ocultar/most El botón Borrar permite reiniciar toda la ventana y borrar todas las interacciones. Es equivalente a cerrar/reabrir el cuadro de diálogo de IA. +## Multi-level list style sheets + +4D Write Pro Interface allows users to create and manage [multi-level lists](./user-legacy/using-a-4d-write-pro-area.md#multi-level-lists) directly from both the toolbar and widget sidebar. + +**Toolbar:** + +![](../assets/en/WritePro/wp-multi-level-list-stylesheets1.png) + +**Sidebar:** + +![](../assets/en/WritePro/wp-multi-level-list-stylesheets2.png) + +To manage multi-level list style sheets, click the ![](../assets/en/WritePro/wp-multi-level-list-button.png) multi-level list button. + +When the multi-level list mode is enabled, the Style Sheets panel displays the [multi-level list style sheets](./user-legacy/stylesheets.md#multi-level-list-style-sheets) defined in the document as well as [predefined templates](#predefined-templates). + +![](../assets/en/WritePro/wp-multi-level-list-panel.png) + +### Managing multi-level style sheets + +The Style Sheets panel allows you in general to: + +- ![](../assets/en/WritePro/wp-multi-level-list-button1.png) Create a new style sheet. +- ![](../assets/en/WritePro/wp-multi-level-list-button2.png) Delete a style sheet. +- ![](../assets/en/WritePro/wp-multi-level-list-button3.png) Update a style sheet. + +Once a multi-level list style sheet is selected, the panel provides also tools to manage the hierarchy and numbering of the list: + +- ![](../assets/en/WritePro/wp-multi-level-list-button4.png) Increase the list level of selected paragraphs. +- ![](../assets/en/WritePro/wp-multi-level-list-button5.png) Decrease the list level of selected paragraphs. +- ![](../assets/en/WritePro/wp-multi-level-list-button6.png) Append a level to the list and create a new sub-level. +- ![](../assets/en/WritePro/wp-multi-level-list7.png) Modify numbering formats. +- ![](../assets/en/WritePro/wp-multi-level-list-button8.png) Concatenate numbering markers between levels. + +### Creating a style sheet + +To create a multi-level list style sheet you can either: + +- Select and apply one of the predefined templates to the paragraph(s), the selected template and all it sub-levels are then displayed on the top part of the sytle sheets panel. You can customize its levels and formatting (such as numbering styles, colors, fonts, or hierarchy), and then create a new style sheet based on the resulting selection. + +- Duplicate one of the existing style sheets via the Duplicate option in the ![](../assets/en/WritePro/wp-multi-level-list-button1.png) bottom menu. + +- Click the ![](../assets/en/WritePro/wp-multi-level-list-button1.png) button and then "New style sheet based on selection" after having selected paragraph(s) to use for the style sheet according to the following: + - If the selected paragraph(s) use(s) a list marker, a new multi-level list style sheet made of one level is created based on the current formatting. + - If the selected paragraph(s) already use(s) a root-level or a sub-level of a multi-level list style sheet, the complete hierarchy is duplicated. + +:::note + +For detailed information about creating and configuring multi-level list style sheets by programming, see [Multi-level list style sheets](./user-legacy/stylesheets.md#multi-level-list-style-sheets). + +::: + +### Applying a multi-level list + +You can apply either a multi-level list style sheet defined in the document or one of the predefined templates to the selected paragraphs using the Style Sheets panel: + +![](../assets/en/WritePro/wp-multi-level-list-panel2.png) + +### Predefined templates + +The interface provides the following predefined multi-level list templates: + +**Technical Blueprint** + +Level 1: 1 +Level 2: 1.1 +Level 3: 1.1.1 +Level 4: 1.1.1.1 +Level 5: 1.1.1.1.1 + +**Legal & Governance** + +Level 1: I. +Level 2: A. +Level 3: 1. +Level 4: a) +Level 5: (1) +Level 6: (a) +Level 7: (i) + +**Educational Material** + +Level 1: I. +Level 2: 1. +Level 3: 1.1. +Level 4: a. +Level 5: ● + +**Meeting Minutes** + +Level 1: 1. +Level 2: ● + +**Visual Hierarchy** + +Level 1: ♣ (Club) +Level 2: ♦ (Diamond) +Level 3: ■ (Square) +Level 4: □ (Hollow Square) +Level 5: ● (Disc) +Level 6: ○ (Circle) +Level 7: – (Dash) + +### Customizing predefined templates + +You can customize the available templates to provide users with predefined multi-level lists that match the needs of your application. + +The predefined multi-level list templates are defined in a JSON file named `multiLevelStyles.json`. This file is located in the 4D Write Pro Interface component Resources folder. + +You can customize the available templates by adding your own `multiLevelStyles.json` file in either: + +- the project's local Resources folder directly, +- a `4D WritePro Interface` folder located within the project Resources folder. + +If a `multiLevelStyles.json` file is present in both locations, the file located in the `4D WritePro Interface` folder takes precedence. + +Each template definition includes: + +- a template name, +- one or more list levels, +- the 4D Write Pro attributes applied to each level. Any 4D Write Pro attribute can be used in a template definition. + +You can use either the attribute names or the corresponding 4D Write Pro constants as JSON keys and values. +For example, the following definitions are equivalent: + +- `"listStyleType": "wk upper roman"` +- `"wk list style type": "wk upper roman"` + +#### Ejemplo + +Example of a customized JSON file: + +```json +{ + "predefinedMultiLevelLists": [ + { + "name": "Technical Blue Print Updated", + "levels": [ + { "listStyleType": "wk decimal" }, + { "listStyleType": "wk decimal", "listConcatStringFormat": true } + ] + } + ] +} +``` + +### Ver también + +- [Related blog post: Multi-Level Style Sheets in 4D Write Pro: Now With a Dedicated UI](https://blog.4d.com/multi-level-style-sheets-in-4d-write-pro-now-with-a-dedicated-ui) +- [multi-level list style sheets](./user-legacy/stylesheets.md#multi-level-list-style-sheets) +- [multi-level lists](.user-legacy/using-a-4d-write-pro-area.md#multi-level-lists) \ No newline at end of file diff --git a/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button.png b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button.png new file mode 100644 index 00000000000000..5f8e7ee323f616 Binary files /dev/null and b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button.png differ diff --git a/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button1.png b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button1.png new file mode 100644 index 00000000000000..07da3e87098960 Binary files /dev/null and b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button1.png differ diff --git a/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button2.png b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button2.png new file mode 100644 index 00000000000000..088e4c64ed531e Binary files /dev/null and b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button2.png differ diff --git a/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button3.png b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button3.png new file mode 100644 index 00000000000000..ddda09768ac90f Binary files /dev/null and b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button3.png differ diff --git a/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button4.png b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button4.png new file mode 100644 index 00000000000000..aadcadc4745659 Binary files /dev/null and b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button4.png differ diff --git a/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button5.png b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button5.png new file mode 100644 index 00000000000000..7de845916f4a1f Binary files /dev/null and b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button5.png differ diff --git a/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button6.png b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button6.png new file mode 100644 index 00000000000000..636cb5780823cd Binary files /dev/null and b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button6.png differ diff --git a/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button8.png b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button8.png new file mode 100644 index 00000000000000..0d5031837e8773 Binary files /dev/null and b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button8.png differ diff --git a/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel.png b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel.png new file mode 100644 index 00000000000000..652d71520d5fe7 Binary files /dev/null and b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel.png differ diff --git a/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel2.png b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel2.png new file mode 100644 index 00000000000000..6e3c56f16b0d7a Binary files /dev/null and b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel2.png differ diff --git a/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets1.png b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets1.png new file mode 100644 index 00000000000000..10c1d6e47429a9 Binary files /dev/null and b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets1.png differ diff --git a/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets2.png b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets2.png new file mode 100644 index 00000000000000..a0d750f5bd4f62 Binary files /dev/null and b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets2.png differ diff --git a/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list7.png b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list7.png new file mode 100644 index 00000000000000..646a3d751ced01 Binary files /dev/null and b/i18n/es/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list7.png differ diff --git a/i18n/es/docusaurus-plugin-content-docs/version-21-R3/API/DataClassClass.md b/i18n/es/docusaurus-plugin-content-docs/version-21-R3/API/DataClassClass.md index 9d0af49a9465bc..db232bf2a34969 100644 --- a/i18n/es/docusaurus-plugin-content-docs/version-21-R3/API/DataClassClass.md +++ b/i18n/es/docusaurus-plugin-content-docs/version-21-R3/API/DataClassClass.md @@ -1222,11 +1222,11 @@ Si *attributePath* designa un atributo que almacena [**objetos vectores**](../AP En este caso, el parámetro *value* debe ser un **objeto vectorial de comparación** que contenga las siguientes propiedades: -| Propiedad | Tipo | Descripción | -| --------- | -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| vector | [4D.Vector](../API/VectorClass.md) | Obligatorio. El vector a comparar | -| metric | Text | Opcional. [Cálculo vectorial](../API/VectorClass.md#understanding-the-different-vector-computations) a utilizar para la consulta. Puede utilizar una de las siguientes constantes (Texto)
  • :`mk cosine` (por defecto si se omite): calcula la similitud coseno entre los vectores.
  • `mk dot`: calcula la similitud en puntos de los vectores.
  • `mk euclidean`: calcula la distancia euclidiana entre vectores. | -| threshold | Real | Opcional (por defecto: 0,5). Un valor umbral utilizado para filtrar las comparaciones de vectores en función de su puntuación de similitud coseno, punto o euclídea según la "métrica" seleccionada. Es altamente recomendable elegir una similitud que se adapte mejor a su caso de uso específico para obtener resultados óptimos. | +| Propiedad | Tipo | Descripción | +| --------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| vector | [4D.Vector](../API/VectorClass.md) | Obligatorio. El vector a comparar | +| metric | Text | Opcional. [Cálculo vectorial](../API/VectorClass.md#understanding-the-different-vector-computations) a utilizar para la consulta. You can use one of the following (Text) constants:
  • `mk cosine` (default if omitted): calculates the [cosine similarity](./VectorClass.md#cosinesimilarity) between vectors.
  • `mk dot`: calculates the [dot similarity](VectorClass.md#dotsimilarity) of vectors.
  • `mk euclidean`: calculates the [Euclidean distance](./VectorClass.md#euclideandistance) between vectors. | +| threshold | Real | Opcional (por defecto: 0,5). Un valor umbral utilizado para filtrar las comparaciones de vectores en función de su puntuación de similitud coseno, punto o euclídea según la "métrica" seleccionada. Es altamente recomendable elegir una similitud que se adapte mejor a su caso de uso específico para obtener resultados óptimos. | Sólo se admite un subconjunto de símbolos **comparadores**. Tenga en cuenta que comparan los resultados con el valor umbral: @@ -1241,8 +1241,8 @@ Por ejemplo, se desea devolver entidades de MyClass donde la similaridad con un ```4d var $myVector : 4D.Vector -$myVector := getVector ///método para obtener un vector, por ejemplo a partir de 4D.AIKit -var $comparisonVector := {vector: $myVector; metric: mk euclidean; threshold: 1.2} +$myVector := getVector //method to get a vector, e.g. from 4D.AIKit +var $comparisonVector := {vector: $myVector; metric: mk cosine; threshold: 1.2} var $results := ds.MyClass.query("myVectorField <= :1"; $comparisonVector) ``` @@ -1250,20 +1250,24 @@ La instrucción **orden by** es soportada en la cadena de consulta para que las ```4d var $results := ds.MyClass.query("myVectorField > :1 order by myVectorField desc"; $comparisonVector) - //the first entity is the most similar + //$results.first() entity is the most similar ``` :::note -The default order is ascending, although a descending order is usually the most useful for vector similarity queries. Thus, you will usually have to add the `desc` keyword in your vector similarity query strings. +You will generally want vector similarity query results to be sorted from "most similar" to "least similar." By default, results returned with an **order by** clause are sorted in ascending order. Depending on the similarity metric used, you may need to adjust the sorting direction to obtain the correct ranking: + +- for [**cosine**](./VectorClass.md#cosinesimilarity) and [**dot**](./VectorClass.md#dotsimilarity) similarity, higher values indicate greater similarity. Therefore, you will typically need to include the `desc` keyword in the query string. +- for [**euclidean distance**](./VectorClass.md#euclideandistance) similarity, lower values indicate greater similarity. In this case, the default ascending order (or explicitly using the `asc` keyword) is appropriate. ::: -Si el mismo vector aparece varias veces en la cadena de consulta, el orden por se aplicará a los resultados del primero, por ejemplo: +You can only order on a single vector field. Si el mismo vector aparece varias veces en la cadena de consulta, el orden por se aplicará a los resultados del primero, por ejemplo: ```4d var $results := ds.MyClass.query("myVectorField > :1 and myVectorField > :2 order by myVectorField desc"; / - {vector : $myVector1 };{vector : $myVector2 }) //myVectorField > :1 is used for the order by + {vector : $myVector1 };{vector : $myVector2 }) + //myVectorField > :1 is used for the order by ``` Ver [más ejemplos a continuación](#example-4-2) (ejemplos 4 y 5). @@ -1271,6 +1275,7 @@ Ver [más ejemplos a continuación](#example-4-2) (ejemplos 4 y 5). :::tip Entradas de blog relacionadas - [4D AI: Búsqueda de entidades por similaridad vectorial en 4D](https://blog.4d.com/4d-ai-searching-entities-by-vector-similarity-in-4d) +- [4D AI: Sorting Query Results by Vector Similarity](https://blog.4d.com/4d-ai-sorting-query-results-by-vector-similarity/) - [Por qué su Pila de búsqueda está rota y cómo lo soluciona la búsqueda vectorial](https://blog.4d.com/why-your-search-stack-feels-broken-and-how-vector-search-fixes-it) ::: @@ -1637,31 +1642,29 @@ var $client:=cs.AIKit.OpenAI.new("my api key") var $result:=$client.embeddings.create("my long text to search"; "text-embedding-ada-002") var $vector:=$result.vector - //el atributo embedding se basa en un campo 4D que almacena objetos de clase 4D.Vector - //buscar con la métrica por defecto (coseno) -var $employees:=ds.Employee.query("embedding > :1"; {vector : $vector}) - //buscar con la métrica euclídea -var $employees:=ds.Employee.query("embedding > :1"; {vector: $vector; metric: mk euclidean}) - //búsqueda con métrica coseno explícita y umbral personalizado -var $employees:=ds.Employee.query("embedding > :1"; {vector: $vector; metric: mk cosine; threshold: 0.9}) - //buscar con una fórmula + //embedding attribute is based upon a 4D field storing 4D.Vector class objects + + //search with default metric (cosine) +var $employees:=ds.Employee.query("embedding > :1 order by embedding desc"; {vector : $vector}) + + //search with euclidean metric +var $employees:=ds.Employee.query("embedding < :1 order by embedding"; {vector: $vector; metric: mk euclidean}) + + //search with explicit cosine metric and custom threshold +var $employees:=ds.Employee.query("embedding > :1 order by embedding desc"; {vector: $vector; metric: mk cosine; threshold: 0.9}) + + //search with a formula var $employees:=ds.Employee.query(Formula(This.embdedding.cosineSimilarity($vector)>0.9)) ``` #### Ejemplo 5 -Queremos ejecutar una consulta por similitud vectorial utilizando vectores con diferentes métricas y ordenar los resultados por similaridades de coseno: +Vector-based semantic ordering can be combined with traditional ORDA filters in the same query. ```4d - //Crear los vectores de comparación -var $vector1Comparison:={vector: $myvector; métrica: mk coseno; umbral: 0.4} -var $vector2Comparison:={vector: $myvector; metric: mk euclidean; threshold:1} - - //el atributo embedding se basa en un campo 4D que almacena objetos de clase 4D.Vector -ds.VectorTable.query("embedding>:1 and embedding<:2";$vector1Comparison;$vector2Comparison)\ - .orderByFormula(Formula(This.embedding.cosineSimilarity($vector1Comparison))) - +var $comparisonVector := {vector: $myVector; metric: mk cosine; threshold: 0.4} +var $results := ds.MyTable.query("myVectorField <= :1 AND salary>100000 order by myVectorField, salary desc"; $comparisonVector) ``` #### Ver también diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/API/DataClassClass.md b/i18n/fr/docusaurus-plugin-content-docs/current/API/DataClassClass.md index 1b8d06c449ee92..904c24f4ea9fa8 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/API/DataClassClass.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/API/DataClassClass.md @@ -1216,11 +1216,11 @@ Si *attributePath* désigne un attribut stockant des [**objets vecteurs**](../AP Dans ce cas, le paramètre *value* doit être un **objet vecteur de comparaison** contenant les propriétés suivantes : -| Propriété | Type | Description | -| --------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| vector | [4D.Vector](../API/VectorClass.md) | Obligatoire. Le vecteur à comparer | -| metric | Text | Optionnel. [Calcul vectoriel](../API/VectorClass.md#understanding-the-different-vector-computations) à utiliser pour la recherche. Vous pouvez utiliser l'une des constantes (texte) suivantes
  • :`mk cosine` (par défaut si omis) : calcule la similarité en cosinus entre les vecteurs.
  • `mk dot` : calcule la similarité en points des vecteurs.
  • `mk euclidean` : calcule la distance euclidienne entre les vecteurs. | -| threshold | Real | Facultatif (valeur par défaut : 0,5). Valeur seuil utilisée pour filtrer les comparaisons de vecteurs sur la base de leur score de similarité cosinus, point ou euclidienne selon la "métrique" sélectionnée. Il est fortement recommandé de choisir une similitude qui corresponde le mieux à votre cas d'utilisation spécifique pour des résultats optimaux. | +| Propriété | Type | Description | +| --------- | -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| vector | [4D.Vector](../API/VectorClass.md) | Obligatoire. Le vecteur à comparer | +| metric | Text | Optionnel. [Calcul vectoriel](../API/VectorClass.md#understanding-the-different-vector-computations) à utiliser pour la recherche. You can use one of the following (Text) constants:
  • `mk cosine` (default if omitted): calculates the [cosine similarity](./VectorClass.md#cosinesimilarity) between vectors.
  • `mk dot`: calculates the [dot similarity](VectorClass.md#dotsimilarity) of vectors.
  • `mk euclidean`: calculates the [Euclidean distance](./VectorClass.md#euclideandistance) between vectors. | +| threshold | Real | Facultatif (valeur par défaut : 0,5). Valeur seuil utilisée pour filtrer les comparaisons de vecteurs sur la base de leur score de similarité cosinus, point ou euclidienne selon la "métrique" sélectionnée. Il est fortement recommandé de choisir une similitude qui corresponde le mieux à votre cas d'utilisation spécifique pour des résultats optimaux. | Seul un sous-ensemble de symboles **comparateurs** est pris en charge. Notez qu'ils comparent les résultats à la valeur de seuil (threshold) : @@ -1235,29 +1235,33 @@ Par exemple, vous souhaitez renvoyer les entités de MyClass dont la similarité ```4d var $myVector : 4D.Vector -$myVector := getVector //méthode pour obtenir un vecteur, par exemple à partir de 4D.AIKit -var $comparisonVector := {vector : $myVector; metric : mk euclidean ; threshold : 1.2} -var $results := ds.MyClass.query("myVectorField <= :1" ; $comparisonVector) +$myVector := getVector //method to get a vector, e.g. from 4D.AIKit +var $comparisonVector := {vector: $myVector; metric: mk cosine; threshold: 1.2} +var $results := ds.MyClass.query("myVectorField <= :1"; $comparisonVector) ``` L'instruction **order by** est prise en charge dans la chaîne de requête afin que les entités de l'entity selection résultante soient triées par similarité. Par exemple : ```4d var $results := ds.MyClass.query("myVectorField > :1 order by myVectorField desc"; $comparisonVector) - //la première entité est la plus similaire + //$results.first() entity is the most similar ``` :::note -L'ordre par défaut est croissant, alors qu'un ordre décroissant soit généralement le plus utile pour les requêtes de similarité vectorielle. Par conséquent, vous devrez généralement ajouter le mot-clé `desc` dans vos chaînes de requête de similarité vectorielle. +You will generally want vector similarity query results to be sorted from "most similar" to "least similar." By default, results returned with an **order by** clause are sorted in ascending order. Depending on the similarity metric used, you may need to adjust the sorting direction to obtain the correct ranking: + +- for [**cosine**](./VectorClass.md#cosinesimilarity) and [**dot**](./VectorClass.md#dotsimilarity) similarity, higher values indicate greater similarity. Therefore, you will typically need to include the `desc` keyword in the query string. +- for [**euclidean distance**](./VectorClass.md#euclideandistance) similarity, lower values indicate greater similarity. In this case, the default ascending order (or explicitly using the `asc` keyword) is appropriate. ::: -Si le même vecteur apparaît plusieurs fois dans la chaîne de requête, l'ordre par sera appliqué aux résultats du premier, par exemple : +You can only order on a single vector field. Si le même vecteur apparaît plusieurs fois dans la chaîne de requête, l'ordre par sera appliqué aux résultats du premier, par exemple : ```4d -var $results := ds.MyClass.query("myVectorField > :1 and myVectorField > :2 order by myVectorField desc" ; / - {vector : $myVector1 };{vector : $myVector2 }) //myVectorField > :1 est utilisé pour le tri +var $results := ds.MyClass.query("myVectorField > :1 and myVectorField > :2 order by myVectorField desc"; / + {vector : $myVector1 };{vector : $myVector2 }) + //myVectorField > :1 is used for the order by ``` Voir [plus d'exemples ci-dessous](#example-4-2) (exemples 4 et 5). @@ -1265,6 +1269,7 @@ Voir [plus d'exemples ci-dessous](#example-4-2) (exemples 4 et 5). :::tip Articles de blog sur le sujet - [4D AI : Recherche d'entités par similarité vectorielle en 4D](https://blog.4d.com/4d-ai-searching-entities-by-vector-similarity-in-4d) +- [4D AI: Sorting Query Results by Vector Similarity](https://blog.4d.com/4d-ai-sorting-query-results-by-vector-similarity/) - [Why Your Search Stack Feels Broken — and How Vector Search Fixes It](https://blog.4d.com/why-your-search-stack-feels-broken-and-how-vector-search-fixes-it) ::: @@ -1628,34 +1633,32 @@ Cet exemple illustre les différentes syntaxes prises en charge pour les recherc ```4d var $client:=cs.AIKit.OpenAI.new("my api key") -var $result:=$client.embeddings.create("my long text to search" ; "text-embedding-ada-002") +var $result:=$client.embeddings.create("my long text to search"; "text-embedding-ada-002") var $vector:=$result.vector - //l'attribut embeddings est basé sur un champ 4D stockant des objets de la classe 4D.Vector - //recherche avec la métrique par défaut (cosinus) -var $employees:=ds.Employee.query("embedding > :1" ; {vector : $vector}) - //recherche avec la métrique euclidienne -var $employees:=ds.Employee.query("embedding > :1" ; {vector : $vector; metric : mk euclidean}) - //recherche avec métrique cosinus explicite et seuil personnalisé -var $employees:=ds.Employee.query("embedding > :1" ; {vector : $vector; metric : mk cosine ; threshold : 0.9}) - //recherche avec une formule + //embedding attribute is based upon a 4D field storing 4D.Vector class objects + + //search with default metric (cosine) +var $employees:=ds.Employee.query("embedding > :1 order by embedding desc"; {vector : $vector}) + + //search with euclidean metric +var $employees:=ds.Employee.query("embedding < :1 order by embedding"; {vector: $vector; metric: mk euclidean}) + + //search with explicit cosine metric and custom threshold +var $employees:=ds.Employee.query("embedding > :1 order by embedding desc"; {vector: $vector; metric: mk cosine; threshold: 0.9}) + + //search with a formula var $employees:=ds.Employee.query(Formula(This.embdedding.cosineSimilarity($vector)>0.9)) ``` #### Exemple 5 -Nous voulons exécuter une recherche par similarité vectorielle en utilisant des vecteurs avec différentes métriques et classer les résultats par similarité de cosinus : +Vector-based semantic ordering can be combined with traditional ORDA filters in the same query. ```4d - /Créer les vecteurs de comparaison -var $vector1Comparison:={vector: $myvector; metric: mk cosinus ; treshold: 0.4} -var $vector2Comparison:={vector: $myvector; metric: mk euclidienne ; treshold:1} - - //l'attribut embedding est basé sur un champ 4D stockant des objets de la classe 4D.Vector -ds.VectorTable.query("embedding>:1 and embedding<:2" ;$vector1Comparison;$vector2Comparison)\ - .orderByFormula(Formula(This.embedding.cosineSimilarity($vector1Comparison))) - +var $comparisonVector := {vector: $myVector; metric: mk cosine; threshold: 0.4} +var $results := ds.MyTable.query("myVectorField <= :1 AND salary>100000 order by myVectorField, salary desc"; $comparisonVector) ``` #### Voir également diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/Notes/updates.md b/i18n/fr/docusaurus-plugin-content-docs/current/Notes/updates.md index 26b4fe3db318b9..468d50b06ec339 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/Notes/updates.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/Notes/updates.md @@ -9,7 +9,8 @@ Read [**What’s new in 4D 21 R4**](https://blog.4d.com/whats-new-in-4d-21-r4/), #### Points forts -- New [`defer`](../commands/defer) command to declare some code to be always executed at method or function exit. +- Multi-level list style sheets are now [supported in 4D Write Pro Interface](../WritePro/writeprointerface.md#multi-level-style-sheets), allowing users to create and manage structured multi-level lists directly from the toolbar and sidebar. +- New [`defer`](../commands/defer) command to declare some code to be always executed at method or function exit; new [`Deferred formulas`](../commands/deferred-formulas) command to get the list of deferred formulas. ## 4D 21 R3 @@ -18,7 +19,7 @@ Lisez [**Les nouveautés de 4D 21 R3**](https://blog.4d.com/fr/whats-new-in-4d-2 #### Points forts - La commande [`JSON Validate`](../commands/json-validate) prend désormais en charge le draft du schéma JSON 2020-12. -- 4D Write Pro prend en charge les [feuilles de style de liste hiérarchique](../WritePro/user-legacy/stylesheets.md#hierarchical-list-style-sheets), ce qui permet de créer et de gérer des [listes à plusieurs niveaux](../WritePro/user-legacy/using-a-4d-write-pro-area.md#multi-level-lists) structurées avec numérotation automatique. +- 4D Write Pro now supports [multi-level list style sheets](../WritePro/user-legacy/stylesheets.md#multi-level-list-style-sheets), enabling the creation and management of structured [multi-level lists](../WritePro/user-legacy/using-a-4d-write-pro-area.md#multi-level-lists) with automatic numbering. - Possibilité d'utiliser un certificat personnalisé provenant du trousseau de macOS au lieu d'un dossier de certificats local dans les classes [`HTTPRequest`](../API/HTTPRequestClass.md#4dhttprequestnew) et [`HTTPAgent`](../API/HTTPAgentClass.md#4dhttpagentnew). - Nouvelle classe [`4D.Method`](../API/MethodClass.md) pour créer et exécuter le code d'une méthode 4D à partir d'un texte source. Les commandes [`METHOD Get path`](../commands/method-get-path) et [`METHOD RESOLVE PATH`](../commands/method-resolve-path) prennent charge une nouvelle constante `path volatile method` (128). - Le transporteur IMAP prend désormais en charge les notifications d'événements de boîte aux lettres utilisant le protocole IDLE via un objet [notifier](../API/IMAPTransporterClass.md#notifier) de la classe [4D.IMAPNotifier](../API/IMAPNotifierClass.md), configurable via la propriété `listener` de [IMAP New transporter](../commands/imap-new-transporter). diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/WritePro/user/user-new.md b/i18n/fr/docusaurus-plugin-content-docs/current/WritePro/user/user-new.md index 923ee2ff782d5f..d41a9b019f19dc 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/WritePro/user/user-new.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/WritePro/user/user-new.md @@ -10,7 +10,7 @@ to import ## Listes -4D Write Pro supports flat lists (single-level) and hierarchical lists (multi-level). +4D Write Pro supports flat lists (single-level) and multi-level lists. ### Single-level lists @@ -39,7 +39,7 @@ Lorsque la liste est créée à l'aide de la commande WP SET ATTRIBUTE(../comman ### Multi-level lists -Multi-level lists are based on [hierarchical list style sheets](../user-legacy/stylesheets.md#hierarchical-list-style-sheets). Multi-level lists contain a root-level style sheet and one or more sub-level style sheet(s). Each level is attached to a hierarchical list style sheet and represents a depth in the list (level 1, level 2, level 3, etc.). +Multi-level lists are based on [multi-level list style sheets](../user-legacy/stylesheets.md#multi-level-list-style-sheets). Multi-level lists contain a root-level style sheet and one or more sub-level style sheet(s). Each level is attached to a multi-level list style sheet and represents a depth in the list (level 1, level 2, level 3, etc.). When a new sub-level is created, the level numbering restarts at 1. When you add or remove an element in your multi-level list, the numbers are automatically adjusted. @@ -55,30 +55,30 @@ Multi-level lists can be managed using: :::tip Article(s) de blog sur le sujet -[4D Write Pro – Creating Multi-level Bullet or Numbered Lists Using Hierarchical list Style Sheets](https://blog.4d.com/4d-write-pro-creating-multi-level-bullet-or-numbered-lists-using-hierarchical-paragraph-style-sheets) +[4D Write Pro – Creating Multi-level Bullet or Numbered Lists Using Multi-level list Style Sheets](https://blog.4d.com/4d-write-pro-creating-multi-level-bullet-or-numbered-lists-using-multi-level-paragraph-style-sheets) ::: - + -## Hierarchical list style sheets +## Multi-level list style sheets -Hierarchical list style sheets are used to create [multi-level lists](../user-legacy/using-a-4d-write-pro-area.md#multi-level-lists). +Multi-level list style sheets are used to create [multi-level lists](../user-legacy/using-a-4d-write-pro-area.md#multi-level-lists). -To create a hierarchical list style sheet, use [WP New style sheet](../commands/wp-new-style-sheet.md) and pass in *listLevelCount* the desired number of levels. You then define a hierarchy of related paragraph style sheets: one **root-level** style sheet and one or more **sub-level** style sheets linked to it. Each level represents a depth in the list (level 1, level 2, level 3, etc.) and is automatically named "root-level name + lvl + index", for example "Mylist lvl 2". +To create a multi-level list style sheet, use [WP New style sheet](../commands/wp-new-style-sheet.md) and pass in *listLevelCount* the desired number of levels. You then define a hierarchy of related paragraph style sheets: one **root-level** style sheet and one or more **sub-level** style sheets linked to it. Each level represents a depth in the list (level 1, level 2, level 3, etc.) and is automatically named "root-level name + lvl + index", for example "Mylist lvl 2". -To customize hierarchical list styles, the paragraph style sheet object can be customized using [style sheet attributes](../commands-legacy/4d-write-pro-attributes.md#style-sheets). +To customize multi-level list styles, the paragraph style sheet object can be customized using [style sheet attributes](../commands-legacy/4d-write-pro-attributes.md#style-sheets). -Hierarchical list style sheets are fully supported by the following commands: [`WP Get style sheet`](../commands/wp-get-style-sheet.md), [`WP SET ATTRIBUTES`](../commands/wp-set-attributes.md), [`WP DELETE STYLE SHEET`](../commands/wp-delete-style-sheet.md). +Multi-level list style sheets are fully supported by the following commands: [`WP Get style sheet`](../commands/wp-get-style-sheet.md), [`WP SET ATTRIBUTES`](../commands/wp-set-attributes.md), [`WP DELETE STYLE SHEET`](../commands/wp-delete-style-sheet.md). ### Exemple -The following example creates a three-level hierarchical list style sheet and applies it to paragraphs. +The following example creates a three-level multi-level list style sheet and applies it to paragraphs. ```4d -// Create 3 hierarchical list style sheets +// Create 3 multi-level list style sheets WP New style sheet(wpArea; wk type paragraph; "MyList"; 3) // Retrieve each level @@ -92,7 +92,7 @@ WP SET ATTRIBUTES($level1; {listStyleType: wk upper latin; fontBold: wk true}) WP SET ATTRIBUTES($level2; {listConcatStringFormat: True}) WP SET ATTRIBUTES($level3; {listStringFormatLtr: "(#)"}) -// Apply hierarchical style sheets to paragraphs +// Apply multi-level style sheets to paragraphs var $paragraphs : Collection $paragraphs:=WP Get elements(wpArea; wk type paragraph) @@ -103,7 +103,7 @@ WP SET ATTRIBUTES($paragraphs[2]; wk style sheet; $level3) result: -![](../../assets/en/WritePro/hierarchical-paragraph-stylesheets-1.png) +![](../../assets/en/WritePro/multi-level-paragraph-stylesheets-1.png) To delete the first sub-leve: @@ -113,11 +113,11 @@ WP DELETE STYLE SHEET(wpArea; "MyList"; 2) result: -![](../../assets/en/WritePro/hierarchical-paragraph-stylesheets-2.png) +![](../../assets/en/WritePro/multi-level-paragraph-stylesheets-2.png) ### Predefined attribute values -When created, hierarchical list style sheets use predefined values: +When created, multi-level list style sheets use predefined values: - `wk margin left` = 0.75 cm \* (number of previous levels) or 0.25 inches \* (number of previous levels), depending on current layout unit - `wk list type` = `wk decimal` diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/WritePro/writeprointerface.md b/i18n/fr/docusaurus-plugin-content-docs/current/WritePro/writeprointerface.md index 3ec379f1736fda..9fccc21ef09bff 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/WritePro/writeprointerface.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/WritePro/writeprointerface.md @@ -1,8 +1,8 @@ ---- +d--- id: writeprointerface title: 4D Write Pro Interface slug: /WritePro/write-pro-interface ---- +--------------------------------------------------- L'interface de 4D Write Pro offre un ensemble de palettes, qui permettent aux utilisateurs de personnaliser facilement un document 4D Write Pro. @@ -411,3 +411,154 @@ The History area lists all your prompts sent to the AI. You can hide/show this a The Erase button allows you to reset the whole window and erase all interactions. It is equivalent to close/reopen the AI dialog box. +## Multi-level list style sheets + +4D Write Pro Interface allows users to create and manage [multi-level lists](./user-legacy/using-a-4d-write-pro-area.md#multi-level-lists) directly from both the toolbar and widget sidebar. + +**Toolbar:** + +![](../assets/en/WritePro/wp-multi-level-list-stylesheets1.png) + +**Sidebar:** + +![](../assets/en/WritePro/wp-multi-level-list-stylesheets2.png) + +To manage multi-level list style sheets, click the ![](../assets/en/WritePro/wp-multi-level-list-button.png) multi-level list button. + +When the multi-level list mode is enabled, the Style Sheets panel displays the [multi-level list style sheets](./user-legacy/stylesheets.md#multi-level-list-style-sheets) defined in the document as well as [predefined templates](#predefined-templates). + +![](../assets/en/WritePro/wp-multi-level-list-panel.png) + +### Managing multi-level style sheets + +The Style Sheets panel allows you in general to: + +- ![](../assets/en/WritePro/wp-multi-level-list-button1.png) Create a new style sheet. +- ![](../assets/en/WritePro/wp-multi-level-list-button2.png) Delete a style sheet. +- ![](../assets/en/WritePro/wp-multi-level-list-button3.png) Update a style sheet. + +Once a multi-level list style sheet is selected, the panel provides also tools to manage the hierarchy and numbering of the list: + +- ![](../assets/en/WritePro/wp-multi-level-list-button4.png) Increase the list level of selected paragraphs. +- ![](../assets/en/WritePro/wp-multi-level-list-button5.png) Decrease the list level of selected paragraphs. +- ![](../assets/en/WritePro/wp-multi-level-list-button6.png) Append a level to the list and create a new sub-level. +- ![](../assets/en/WritePro/wp-multi-level-list7.png) Modify numbering formats. +- ![](../assets/en/WritePro/wp-multi-level-list-button8.png) Concatenate numbering markers between levels. + +### Creating a style sheet + +To create a multi-level list style sheet you can either: + +- Select and apply one of the predefined templates to the paragraph(s), the selected template and all it sub-levels are then displayed on the top part of the sytle sheets panel. You can customize its levels and formatting (such as numbering styles, colors, fonts, or hierarchy), and then create a new style sheet based on the resulting selection. + +- Duplicate one of the existing style sheets via the Duplicate option in the ![](../assets/en/WritePro/wp-multi-level-list-button1.png) bottom menu. + +- Click the ![](../assets/en/WritePro/wp-multi-level-list-button1.png) button and then "New style sheet based on selection" after having selected paragraph(s) to use for the style sheet according to the following: + - If the selected paragraph(s) use(s) a list marker, a new multi-level list style sheet made of one level is created based on the current formatting. + - If the selected paragraph(s) already use(s) a root-level or a sub-level of a multi-level list style sheet, the complete hierarchy is duplicated. + +:::note + +For detailed information about creating and configuring multi-level list style sheets by programming, see [Multi-level list style sheets](./user-legacy/stylesheets.md#multi-level-list-style-sheets). + +::: + +### Applying a multi-level list + +You can apply either a multi-level list style sheet defined in the document or one of the predefined templates to the selected paragraphs using the Style Sheets panel: + +![](../assets/en/WritePro/wp-multi-level-list-panel2.png) + +### Predefined templates + +The interface provides the following predefined multi-level list templates: + +**Technical Blueprint** + +Level 1: 1 +Level 2: 1.1 +Level 3: 1.1.1 +Level 4: 1.1.1.1 +Level 5: 1.1.1.1.1 + +**Legal & Governance** + +Level 1: I. +Level 2: A. +Level 3: 1. +Level 4: a) +Level 5: (1) +Level 6: (a) +Level 7: (i) + +**Educational Material** + +Level 1: I. +Level 2: 1. +Level 3: 1.1. +Level 4: a. +Level 5: ● + +**Meeting Minutes** + +Level 1: 1. +Level 2: ● + +**Visual Hierarchy** + +Level 1: ♣ (Club) +Level 2: ♦ (Diamond) +Level 3: ■ (Square) +Level 4: □ (Hollow Square) +Level 5: ● (Disc) +Level 6: ○ (Circle) +Level 7: – (Dash) + +### Customizing predefined templates + +You can customize the available templates to provide users with predefined multi-level lists that match the needs of your application. + +The predefined multi-level list templates are defined in a JSON file named `multiLevelStyles.json`. This file is located in the 4D Write Pro Interface component Resources folder. + +You can customize the available templates by adding your own `multiLevelStyles.json` file in either: + +- the project's local Resources folder directly, +- a `4D WritePro Interface` folder located within the project Resources folder. + +If a `multiLevelStyles.json` file is present in both locations, the file located in the `4D WritePro Interface` folder takes precedence. + +Each template definition includes: + +- a template name, +- one or more list levels, +- the 4D Write Pro attributes applied to each level. Any 4D Write Pro attribute can be used in a template definition. + +You can use either the attribute names or the corresponding 4D Write Pro constants as JSON keys and values. +For example, the following definitions are equivalent: + +- `"listStyleType": "wk upper roman"` +- `"wk list style type": "wk upper roman"` + +#### Exemple + +Example of a customized JSON file: + +```json +{ + "predefinedMultiLevelLists": [ + { + "name": "Technical Blue Print Updated", + "levels": [ + { "listStyleType": "wk decimal" }, + { "listStyleType": "wk decimal", "listConcatStringFormat": true } + ] + } + ] +} +``` + +### Voir également + +- [Related blog post: Multi-Level Style Sheets in 4D Write Pro: Now With a Dedicated UI](https://blog.4d.com/multi-level-style-sheets-in-4d-write-pro-now-with-a-dedicated-ui) +- [multi-level list style sheets](./user-legacy/stylesheets.md#multi-level-list-style-sheets) +- [multi-level lists](.user-legacy/using-a-4d-write-pro-area.md#multi-level-lists) \ No newline at end of file diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button.png b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button.png new file mode 100644 index 00000000000000..5f8e7ee323f616 Binary files /dev/null and b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button.png differ diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button1.png b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button1.png new file mode 100644 index 00000000000000..07da3e87098960 Binary files /dev/null and b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button1.png differ diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button2.png b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button2.png new file mode 100644 index 00000000000000..088e4c64ed531e Binary files /dev/null and b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button2.png differ diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button3.png b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button3.png new file mode 100644 index 00000000000000..ddda09768ac90f Binary files /dev/null and b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button3.png differ diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button4.png b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button4.png new file mode 100644 index 00000000000000..aadcadc4745659 Binary files /dev/null and b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button4.png differ diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button5.png b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button5.png new file mode 100644 index 00000000000000..7de845916f4a1f Binary files /dev/null and b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button5.png differ diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button6.png b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button6.png new file mode 100644 index 00000000000000..636cb5780823cd Binary files /dev/null and b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button6.png differ diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button8.png b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button8.png new file mode 100644 index 00000000000000..0d5031837e8773 Binary files /dev/null and b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button8.png differ diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel.png b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel.png new file mode 100644 index 00000000000000..652d71520d5fe7 Binary files /dev/null and b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel.png differ diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel2.png b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel2.png new file mode 100644 index 00000000000000..6e3c56f16b0d7a Binary files /dev/null and b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel2.png differ diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets1.png b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets1.png new file mode 100644 index 00000000000000..10c1d6e47429a9 Binary files /dev/null and b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets1.png differ diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets2.png b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets2.png new file mode 100644 index 00000000000000..a0d750f5bd4f62 Binary files /dev/null and b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets2.png differ diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list7.png b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list7.png new file mode 100644 index 00000000000000..646a3d751ced01 Binary files /dev/null and b/i18n/fr/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list7.png differ diff --git a/i18n/fr/docusaurus-plugin-content-docs/version-21-R3/API/DataClassClass.md b/i18n/fr/docusaurus-plugin-content-docs/version-21-R3/API/DataClassClass.md index f15a8c29a6cbf1..4b629a119895c6 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/version-21-R3/API/DataClassClass.md +++ b/i18n/fr/docusaurus-plugin-content-docs/version-21-R3/API/DataClassClass.md @@ -1216,11 +1216,11 @@ Si *attributePath* désigne un attribut stockant des [**objets vecteurs**](../AP Dans ce cas, le paramètre *value* doit être un **objet vecteur de comparaison** contenant les propriétés suivantes : -| Propriété | Type | Description | -| --------- | -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| vector | [4D.Vector](../API/VectorClass.md) | Obligatoire. Le vecteur à comparer | -| metric | Text | Optionnel. [Calcul vectoriel](../API/VectorClass.md#understanding-the-different-vector-computations) à utiliser pour la recherche. Vous pouvez utiliser l'une des constantes (texte) suivantes
  • :`mk cosine` (par défaut si omis) : calcule la similarité cosinus entre les vecteurs.
  • `mk dot` : calcule la similarité en points des vecteurs.
  • `mk euclidean` : calcule la distance euclidienne entre les vecteurs. | -| threshold | Real | Facultatif (valeur par défaut : 0,5). Valeur seuil utilisée pour filtrer les comparaisons de vecteurs sur la base de leur score de similarité cosinus, point ou euclidienne selon la "métrique" sélectionnée. Il est fortement recommandé de choisir une similitude qui corresponde le mieux à votre cas d'utilisation spécifique pour des résultats optimaux. | +| Propriété | Type | Description | +| --------- | -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| vector | [4D.Vector](../API/VectorClass.md) | Obligatoire. Le vecteur à comparer | +| metric | Text | Optionnel. [Calcul vectoriel](../API/VectorClass.md#understanding-the-different-vector-computations) à utiliser pour la recherche. You can use one of the following (Text) constants:
  • `mk cosine` (default if omitted): calculates the [cosine similarity](./VectorClass.md#cosinesimilarity) between vectors.
  • `mk dot`: calculates the [dot similarity](VectorClass.md#dotsimilarity) of vectors.
  • `mk euclidean`: calculates the [Euclidean distance](./VectorClass.md#euclideandistance) between vectors. | +| threshold | Real | Facultatif (valeur par défaut : 0,5). Valeur seuil utilisée pour filtrer les comparaisons de vecteurs sur la base de leur score de similarité cosinus, point ou euclidienne selon la "métrique" sélectionnée. Il est fortement recommandé de choisir une similitude qui corresponde le mieux à votre cas d'utilisation spécifique pour des résultats optimaux. | Seul un sous-ensemble de symboles **comparateurs** est pris en charge. Notez qu'ils comparent les résultats à la valeur de seuil (threshold) : @@ -1235,29 +1235,33 @@ Par exemple, vous souhaitez renvoyer les entités de MyClass dont la similarité ```4d var $myVector : 4D.Vector -$myVector := getVector //méthode pour obtenir un vecteur, par exemple à partir de 4D.AIKit -var $comparisonVector := {vector : $myVector; metric : mk euclidean ; threshold : 1.2} -var $results := ds.MyClass.query("myVectorField <= :1" ; $comparisonVector) +$myVector := getVector //method to get a vector, e.g. from 4D.AIKit +var $comparisonVector := {vector: $myVector; metric: mk cosine; threshold: 1.2} +var $results := ds.MyClass.query("myVectorField <= :1"; $comparisonVector) ``` L'instruction **order by** est prise en charge dans la chaîne de requête afin que les entités de l'entity selection résultante soient triées par similarité. Par exemple : ```4d var $results := ds.MyClass.query("myVectorField > :1 order by myVectorField desc"; $comparisonVector) - //la première entité est la plus similaire + //$results.first() entity is the most similar ``` :::note -L'ordre par défaut est croissant, alors qu'un ordre décroissant soit généralement le plus utile pour les requêtes de similarité vectorielle. Par conséquent, vous devrez généralement ajouter le mot-clé `desc` dans vos chaînes de requête de similarité vectorielle. +You will generally want vector similarity query results to be sorted from "most similar" to "least similar." By default, results returned with an **order by** clause are sorted in ascending order. Depending on the similarity metric used, you may need to adjust the sorting direction to obtain the correct ranking: + +- for [**cosine**](./VectorClass.md#cosinesimilarity) and [**dot**](./VectorClass.md#dotsimilarity) similarity, higher values indicate greater similarity. Therefore, you will typically need to include the `desc` keyword in the query string. +- for [**euclidean distance**](./VectorClass.md#euclideandistance) similarity, lower values indicate greater similarity. In this case, the default ascending order (or explicitly using the `asc` keyword) is appropriate. ::: -Si le même vecteur apparaît plusieurs fois dans la chaîne de requête, l'ordre par sera appliqué aux résultats du premier, par exemple : +You can only order on a single vector field. Si le même vecteur apparaît plusieurs fois dans la chaîne de requête, l'ordre par sera appliqué aux résultats du premier, par exemple : ```4d -var $results := ds.MyClass.query("myVectorField > :1 and myVectorField > :2 order by myVectorField desc" ; / - {vector : $myVector1 };{vector : $myVector2 }) //myVectorField > :1 est utilisé pour le tri +var $results := ds.MyClass.query("myVectorField > :1 and myVectorField > :2 order by myVectorField desc"; / + {vector : $myVector1 };{vector : $myVector2 }) + //myVectorField > :1 is used for the order by ``` Voir [plus d'exemples ci-dessous](#example-4-2) (exemples 4 et 5). @@ -1265,6 +1269,7 @@ Voir [plus d'exemples ci-dessous](#example-4-2) (exemples 4 et 5). :::tip Articles de blog sur le sujet - [4D AI : Recherche d'entités par similarité vectorielle en 4D](https://blog.4d.com/4d-ai-searching-entities-by-vector-similarity-in-4d) +- [4D AI: Sorting Query Results by Vector Similarity](https://blog.4d.com/4d-ai-sorting-query-results-by-vector-similarity/) - [Why Your Search Stack Feels Broken — and How Vector Search Fixes It](https://blog.4d.com/why-your-search-stack-feels-broken-and-how-vector-search-fixes-it) ::: @@ -1628,34 +1633,32 @@ Cet exemple illustre les différentes syntaxes prises en charge pour les recherc ```4d var $client:=cs.AIKit.OpenAI.new("my api key") -var $result:=$client.embeddings.create("my long text to search" ; "text-embedding-ada-002") +var $result:=$client.embeddings.create("my long text to search"; "text-embedding-ada-002") var $vector:=$result.vector - //l'attribut embeddings est basé sur un champ 4D stockant des objets de la classe 4D.Vector - //recherche avec la métrique par défaut (cosinus) -var $employees:=ds.Employee.query("embedding > :1" ; {vector : $vector}) - //recherche avec la métrique euclidienne -var $employees:=ds.Employee.query("embedding > :1" ; {vector : $vector; metric : mk euclidean}) - //recherche avec métrique cosinus explicite et seuil personnalisé -var $employees:=ds.Employee.query("embedding > :1" ; {vector : $vector; metric : mk cosine ; threshold : 0.9}) - //recherche avec une formule + //embedding attribute is based upon a 4D field storing 4D.Vector class objects + + //search with default metric (cosine) +var $employees:=ds.Employee.query("embedding > :1 order by embedding desc"; {vector : $vector}) + + //search with euclidean metric +var $employees:=ds.Employee.query("embedding < :1 order by embedding"; {vector: $vector; metric: mk euclidean}) + + //search with explicit cosine metric and custom threshold +var $employees:=ds.Employee.query("embedding > :1 order by embedding desc"; {vector: $vector; metric: mk cosine; threshold: 0.9}) + + //search with a formula var $employees:=ds.Employee.query(Formula(This.embdedding.cosineSimilarity($vector)>0.9)) ``` #### Exemple 5 -Nous voulons exécuter une recherche par similarité vectorielle en utilisant des vecteurs avec différentes métriques et classer les résultats par similarité de cosinus : +Vector-based semantic ordering can be combined with traditional ORDA filters in the same query. ```4d - /Créer les vecteurs de comparaison -var $vector1Comparison:={vector: $myvector; metric: mk cosinus ; treshold: 0.4} -var $vector2Comparison:={vector: $myvector; metric: mk euclidienne ; treshold:1} - - //l'attribut embedding est basé sur un champ 4D stockant des objets de la classe 4D.Vector -ds.VectorTable.query("embedding>:1 and embedding<:2" ;$vector1Comparison;$vector2Comparison)\ - .orderByFormula(Formula(This.embedding.cosineSimilarity($vector1Comparison))) - +var $comparisonVector := {vector: $myVector; metric: mk cosine; threshold: 0.4} +var $results := ds.MyTable.query("myVectorField <= :1 AND salary>100000 order by myVectorField, salary desc"; $comparisonVector) ``` #### Voir également diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/API/DataClassClass.md b/i18n/ja/docusaurus-plugin-content-docs/current/API/DataClassClass.md index cace9204ff16a4..e12dbf88d2c3cb 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/API/DataClassClass.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/API/DataClassClass.md @@ -1222,11 +1222,11 @@ $es:=ds.Movie.query("roles.actor.lastName = :1 AND roles.actor{2}.lastName = :2" この場合、*value* 引数は、以下のプロパティを格納した**比較ベクトルオブジェクト** である必要があります: -| プロパティ | 型 | 説明 | -| --------- | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| vector | [4D.Vector](../API/VectorClass.md) | 必須設定です。 比較するベクトル | -| metric | Text | 任意。 クエリに使用する[ベクトル計算](../API/VectorClass.md#ことなるベクトル計算を理解する)。 以下の(テキストの)定数のいずれか一つを使用することができます:
  • `mk cosine` (省略時にデフォルト): ベクトル間のコサイン類似度を計算します。
  • `mk dot`: ベクトル間のドット類似度を計算します。
  • `mk euclidean`: ベクトル間のユークリッド距離を計算します。 | -| threshold | Real | 任意(デフォルト: 0.5)。 選択された"metric"に従って、コサイン、ドット、またはユークリッド類似度に基づいたベクトル比較をフィルタリングするために使用されるしきい値。 最適な結果を得るためには、特定の用途に最適な類似度のしきい値をきちんと選択することが強く推奨されます。 | +| プロパティ | 型 | 説明 | +| --------- | -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| vector | [4D.Vector](../API/VectorClass.md) | 必須設定です。 比較するベクトル | +| metric | Text | 任意。 クエリに使用する[ベクトル計算](../API/VectorClass.md#ことなるベクトル計算を理解する)。 You can use one of the following (Text) constants:
  • `mk cosine` (default if omitted): calculates the [cosine similarity](./VectorClass.md#cosinesimilarity) between vectors.
  • `mk dot`: calculates the [dot similarity](VectorClass.md#dotsimilarity) of vectors.
  • `mk euclidean`: calculates the [Euclidean distance](./VectorClass.md#euclideandistance) between vectors. | +| threshold | Real | 任意(デフォルト: 0.5)。 選択された"metric"に従って、コサイン、ドット、またはユークリッド類似度に基づいたベクトル比較をフィルタリングするために使用されるしきい値。 最適な結果を得るためには、特定の用途に最適な類似度のしきい値をきちんと選択することが強く推奨されます。 | **comparator** 記号の、一部のみがサポートされます。 これらの比較記号は、結果としきい値を比較するのに使用されるという点に注意してください: @@ -1241,8 +1241,8 @@ $es:=ds.Movie.query("roles.actor.lastName = :1 AND roles.actor{2}.lastName = :2" ```4d var $myVector : 4D.Vector -$myVector := getVector //(例: 4D.AIKit などから)ベクトルを取得するメソッド -var $comparisonVector := {vector: $myVector; metric: mk euclidean; threshold: 1.2} +$myVector := getVector //method to get a vector, e.g. from 4D.AIKit +var $comparisonVector := {vector: $myVector; metric: mk cosine; threshold: 1.2} var $results := ds.MyClass.query("myVectorField <= :1"; $comparisonVector) ``` @@ -1250,20 +1250,24 @@ var $results := ds.MyClass.query("myVectorField <= :1"; $comparisonVector) ```4d var $results := ds.MyClass.query("myVectorField > :1 order by myVectorField desc"; $comparisonVector) - //the first entity is the most similar + //$results.first() entity is the most similar ``` :::note -The default order is ascending, although a descending order is usually the most useful for vector similarity queries. Thus, you will usually have to add the `desc` keyword in your vector similarity query strings. +You will generally want vector similarity query results to be sorted from "most similar" to "least similar." By default, results returned with an **order by** clause are sorted in ascending order. Depending on the similarity metric used, you may need to adjust the sorting direction to obtain the correct ranking: + +- for [**cosine**](./VectorClass.md#cosinesimilarity) and [**dot**](./VectorClass.md#dotsimilarity) similarity, higher values indicate greater similarity. Therefore, you will typically need to include the `desc` keyword in the query string. +- for [**euclidean distance**](./VectorClass.md#euclideandistance) similarity, lower values indicate greater similarity. In this case, the default ascending order (or explicitly using the `asc` keyword) is appropriate. ::: -同じベクトルがクエリ文字列内に複数回出現した場合、order by は最初のものの結果に適用されます。例: +You can only order on a single vector field. 同じベクトルがクエリ文字列内に複数回出現した場合、order by は最初のものの結果に適用されます。例: ```4d var $results := ds.MyClass.query("myVectorField > :1 and myVectorField > :2 order by myVectorField desc"; / - {vector : $myVector1 };{vector : $myVector2 }) //myVectorField > :1 is used for the order by + {vector : $myVector1 };{vector : $myVector2 }) + //myVectorField > :1 is used for the order by ``` 詳細については[以下の例題](#例題-4-2)を参照してください (例題 4 と 5)。 @@ -1271,6 +1275,7 @@ var $results := ds.MyClass.query("myVectorField > :1 and myVectorField > :2 orde :::tip 関連したblog 記事 - [4D AI: Searching Entities by Vector Similarity in 4D](https://blog.4d.com/4d-ai-searching-entities-by-vector-similarity-in-4d) +- [4D AI: Sorting Query Results by Vector Similarity](https://blog.4d.com/4d-ai-sorting-query-results-by-vector-similarity/) - [Why Your Search Stack Feels Broken — and How Vector Search Fixes It](https://blog.4d.com/why-your-search-stack-feels-broken-and-how-vector-search-fixes-it) ::: @@ -1637,30 +1642,29 @@ var $client:=cs.AIKit.OpenAI.new("my api key") var $result:=$client.embeddings.create("my long text to search"; "text-embedding-ada-002") var $vector:=$result.vector - // embedding 属性は4D.Vector クラスオブジェクトを格納した4D フィールドに基づいています - // デフォルトのmetric (コサイン)での検索 -var $employees:=ds.Employee.query("embedding > :1"; {vector : $vector}) - // ユークリッド計量での検索 -var $employees:=ds.Employee.query("embedding > :1"; {vector: $vector; metric: mk euclidean}) - // 明示的にコサイン計量を指定し、カスタムのしきい値を用いた検索 -var $employees:=ds.Employee.query("embedding > :1"; {vector: $vector; metric: mk cosine; threshold: 0.9}) - // フォーミュラを使用した検索 -var $employees:=ds.Employee.query(Formula(This.embedding.cosineSimilarity($vector)>0.9)) + //embedding attribute is based upon a 4D field storing 4D.Vector class objects + + //search with default metric (cosine) +var $employees:=ds.Employee.query("embedding > :1 order by embedding desc"; {vector : $vector}) + + //search with euclidean metric +var $employees:=ds.Employee.query("embedding < :1 order by embedding"; {vector: $vector; metric: mk euclidean}) + + //search with explicit cosine metric and custom threshold +var $employees:=ds.Employee.query("embedding > :1 order by embedding desc"; {vector: $vector; metric: mk cosine; threshold: 0.9}) + + //search with a formula +var $employees:=ds.Employee.query(Formula(This.embdedding.cosineSimilarity($vector)>0.9)) ``` #### 例題 5 -異なるメトリックでのベクトルを使用したベクトル類似度によるクエリを実行し、コサイン類似度で結果を並べ替えたい場合を考えます: +Vector-based semantic ordering can be combined with traditional ORDA filters in the same query. ```4d - // 比較ベクトルを作成 -var $vector1Comparison:={vector: $myvector; metric: mk cosine; threshold: 0.4} -var $vector2Comparison:={vector: $myvector; metric: mk euclidean; threshold:1} - - // embedding 属性は、4D.Vector クラスオブジェクトを格納している4D フィールドに基づいています -ds.VectorTable.query("embedding>:1 and embedding<:2";$vector1Comparison;$vector2Comparison)\ - .orderByFormula(Formula(This.embedding.cosineSimilarity($vector1Comparison))) +var $comparisonVector := {vector: $myVector; metric: mk cosine; threshold: 0.4} +var $results := ds.MyTable.query("myVectorField <= :1 AND salary>100000 order by myVectorField, salary desc"; $comparisonVector) ``` #### 参照 diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/Notes/updates.md b/i18n/ja/docusaurus-plugin-content-docs/current/Notes/updates.md index b945f1f60e7a6a..9cf663b1de6f06 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/Notes/updates.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/Notes/updates.md @@ -9,7 +9,8 @@ Read [**What’s new in 4D 21 R4**](https://blog.4d.com/whats-new-in-4d-21-r4/), #### ハイライト -- New [`defer`](../commands/defer) command to declare some code to be always executed at method or function exit. +- Multi-level list style sheets are now [supported in 4D Write Pro Interface](../WritePro/writeprointerface.md#multi-level-style-sheets), allowing users to create and manage structured multi-level lists directly from the toolbar and sidebar. +- New [`defer`](../commands/defer) command to declare some code to be always executed at method or function exit; new [`Deferred formulas`](../commands/deferred-formulas) command to get the list of deferred formulas. ## 4D 21 R3 @@ -18,7 +19,7 @@ Read [**What’s new in 4D 21 R4**](https://blog.4d.com/whats-new-in-4d-21-r4/), #### ハイライト - [`JSON Validate`](../commands/json-validate) コマンドは、JSON スキーマドラフト 2020-12 をサポートするようになりました。 -- 4D Write Pro は[階層リストスタイルシート](../WritePro/user-legacy/stylesheets.md#hierarchical-list-style-sheets) サポートするようになり、これにより自動ナンバリングつきの、構造化された[マルチレベルのリスト](../WritePro/user-legacy/using-a-4d-write-pro-area.md#multi-level-lists) の作成と管理が可能になりました。 +- 4D Write Pro now supports [multi-level list style sheets](../WritePro/user-legacy/stylesheets.md#multi-level-list-style-sheets), enabling the creation and management of structured [multi-level lists](../WritePro/user-legacy/using-a-4d-write-pro-area.md#multi-level-lists) with automatic numbering. - [`HTTPRequest`](../API/HTTPRequestClass.md#4dhttprequestnew) および [`HTTPAgent`](../API/HTTPAgentClass.md#4dhttpagentnew) クラスにおいて、ローカル証明書フォルダの代わりにmacOS キーチェーンからのカスタムの証明書を使用できるようになりました。 - テキストソースから4D メソッドを作成し実行するための[`4D.Method` クラス](../API/MethodClass.md)。 [`METHOD Get path`](../commands/method-get-path) および [`METHOD RESOLVE PATH`](../commands/method-resolve-path) コマンドは新しい`path volatile method` 定数 (128) をサポートするようになりました。 - IMAP transporter は、[4D.IMAPNotifier](../API/IMAPNotifierClass.md) クラスの、[notifier オブジェクト](../API/IMAPTransporterClass.md#notifier) を通して、IDLE プロトコルを使用したメールボックスイベント通知イベントをサポートするようになりました。またこのクラスは [IMAP New transporter](../commands/imap-new-transporter) の `listener` プロパティを通して設定することができます。 diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/WritePro/user/user-new.md b/i18n/ja/docusaurus-plugin-content-docs/current/WritePro/user/user-new.md index 4f4be24c89075f..9c82afff8390cb 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/WritePro/user/user-new.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/WritePro/user/user-new.md @@ -10,7 +10,7 @@ to import ## リスト -4D Write Pro supports flat lists (single-level) and hierarchical lists (multi-level). +4D Write Pro supports flat lists (single-level) and multi-level lists. ### Single-level lists @@ -39,7 +39,7 @@ When the list is created using [the WP SET ATTRIBUTE command](../commands-legacy ### Multi-level lists -Multi-level lists are based on [hierarchical list style sheets](../user-legacy/stylesheets.md#hierarchical-list-style-sheets). Multi-level lists contain a root-level style sheet and one or more sub-level style sheet(s). Each level is attached to a hierarchical list style sheet and represents a depth in the list (level 1, level 2, level 3, etc.). +Multi-level lists are based on [multi-level list style sheets](../user-legacy/stylesheets.md#multi-level-list-style-sheets). Multi-level lists contain a root-level style sheet and one or more sub-level style sheet(s). Each level is attached to a multi-level list style sheet and represents a depth in the list (level 1, level 2, level 3, etc.). When a new sub-level is created, the level numbering restarts at 1. When you add or remove an element in your multi-level list, the numbers are automatically adjusted. @@ -55,30 +55,30 @@ Multi-level lists can be managed using: :::tip 関連したblog 記事 -[4D Write Pro – Creating Multi-level Bullet or Numbered Lists Using Hierarchical list Style Sheets](https://blog.4d.com/4d-write-pro-creating-multi-level-bullet-or-numbered-lists-using-hierarchical-paragraph-style-sheets) +[4D Write Pro – Creating Multi-level Bullet or Numbered Lists Using Multi-level list Style Sheets](https://blog.4d.com/4d-write-pro-creating-multi-level-bullet-or-numbered-lists-using-multi-level-paragraph-style-sheets) ::: - + -## Hierarchical list style sheets +## Multi-level list style sheets -Hierarchical list style sheets are used to create [multi-level lists](../user-legacy/using-a-4d-write-pro-area.md#multi-level-lists). +Multi-level list style sheets are used to create [multi-level lists](../user-legacy/using-a-4d-write-pro-area.md#multi-level-lists). -To create a hierarchical list style sheet, use [WP New style sheet](../commands/wp-new-style-sheet.md) and pass in *listLevelCount* the desired number of levels. You then define a hierarchy of related paragraph style sheets: one **root-level** style sheet and one or more **sub-level** style sheets linked to it. Each level represents a depth in the list (level 1, level 2, level 3, etc.) and is automatically named "root-level name + lvl + index", for example "Mylist lvl 2". +To create a multi-level list style sheet, use [WP New style sheet](../commands/wp-new-style-sheet.md) and pass in *listLevelCount* the desired number of levels. You then define a hierarchy of related paragraph style sheets: one **root-level** style sheet and one or more **sub-level** style sheets linked to it. Each level represents a depth in the list (level 1, level 2, level 3, etc.) and is automatically named "root-level name + lvl + index", for example "Mylist lvl 2". -To customize hierarchical list styles, the paragraph style sheet object can be customized using [style sheet attributes](../commands-legacy/4d-write-pro-attributes.md#style-sheets). +To customize multi-level list styles, the paragraph style sheet object can be customized using [style sheet attributes](../commands-legacy/4d-write-pro-attributes.md#style-sheets). -Hierarchical list style sheets are fully supported by the following commands: [`WP Get style sheet`](../commands/wp-get-style-sheet.md), [`WP SET ATTRIBUTES`](../commands/wp-set-attributes.md), [`WP DELETE STYLE SHEET`](../commands/wp-delete-style-sheet.md). +Multi-level list style sheets are fully supported by the following commands: [`WP Get style sheet`](../commands/wp-get-style-sheet.md), [`WP SET ATTRIBUTES`](../commands/wp-set-attributes.md), [`WP DELETE STYLE SHEET`](../commands/wp-delete-style-sheet.md). ### 例題 -The following example creates a three-level hierarchical list style sheet and applies it to paragraphs. +The following example creates a three-level multi-level list style sheet and applies it to paragraphs. ```4d -// Create 3 hierarchical list style sheets +// Create 3 multi-level list style sheets WP New style sheet(wpArea; wk type paragraph; "MyList"; 3) // Retrieve each level @@ -92,7 +92,7 @@ WP SET ATTRIBUTES($level1; {listStyleType: wk upper latin; fontBold: wk true}) WP SET ATTRIBUTES($level2; {listConcatStringFormat: True}) WP SET ATTRIBUTES($level3; {listStringFormatLtr: "(#)"}) -// Apply hierarchical style sheets to paragraphs +// Apply multi-level style sheets to paragraphs var $paragraphs : Collection $paragraphs:=WP Get elements(wpArea; wk type paragraph) @@ -103,7 +103,7 @@ WP SET ATTRIBUTES($paragraphs[2]; wk style sheet; $level3) result: -![](../../assets/en/WritePro/hierarchical-paragraph-stylesheets-1.png) +![](../../assets/en/WritePro/multi-level-paragraph-stylesheets-1.png) To delete the first sub-leve: @@ -113,11 +113,11 @@ WP DELETE STYLE SHEET(wpArea; "MyList"; 2) result: -![](../../assets/en/WritePro/hierarchical-paragraph-stylesheets-2.png) +![](../../assets/en/WritePro/multi-level-paragraph-stylesheets-2.png) ### Predefined attribute values -When created, hierarchical list style sheets use predefined values: +When created, multi-level list style sheets use predefined values: - `wk margin left` = 0.75 cm \* (number of previous levels) or 0.25 inches \* (number of previous levels), depending on current layout unit - `wk list type` = `wk decimal` diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/WritePro/writeprointerface.md b/i18n/ja/docusaurus-plugin-content-docs/current/WritePro/writeprointerface.md index 1064babdefb8e9..b5b567f7753c9e 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/WritePro/writeprointerface.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/WritePro/writeprointerface.md @@ -1,8 +1,8 @@ ---- +d--- id: writeprointerface -title: 4D WritePro インターフェース +title: 4D Write Pro Interface slug: /WritePro/write-pro-interface ---- +--------------------------------------------------- 4D WritePro インターフェースは、エンドユーザーが 4D Write Proドキュメントを簡単にカスタマイズできるパレットを提供します。 @@ -414,3 +414,154 @@ AI に質問を送信するためには、送信ボタンをクリックしま 消去ボタンを使用すると全てのやりとりを消去しウィンドウ全体をリセットすることができます。 これはAI ダイアログボックスを閉じて再度開くのと同じです。 +## Multi-level list style sheets + +4D Write Pro Interface allows users to create and manage [multi-level lists](./user-legacy/using-a-4d-write-pro-area.md#multi-level-lists) directly from both the toolbar and widget sidebar. + +**Toolbar:** + +![](../assets/en/WritePro/wp-multi-level-list-stylesheets1.png) + +**Sidebar:** + +![](../assets/en/WritePro/wp-multi-level-list-stylesheets2.png) + +To manage multi-level list style sheets, click the ![](../assets/en/WritePro/wp-multi-level-list-button.png) multi-level list button. + +When the multi-level list mode is enabled, the Style Sheets panel displays the [multi-level list style sheets](./user-legacy/stylesheets.md#multi-level-list-style-sheets) defined in the document as well as [predefined templates](#predefined-templates). + +![](../assets/en/WritePro/wp-multi-level-list-panel.png) + +### Managing multi-level style sheets + +The Style Sheets panel allows you in general to: + +- ![](../assets/en/WritePro/wp-multi-level-list-button1.png) Create a new style sheet. +- ![](../assets/en/WritePro/wp-multi-level-list-button2.png) Delete a style sheet. +- ![](../assets/en/WritePro/wp-multi-level-list-button3.png) Update a style sheet. + +Once a multi-level list style sheet is selected, the panel provides also tools to manage the hierarchy and numbering of the list: + +- ![](../assets/en/WritePro/wp-multi-level-list-button4.png) Increase the list level of selected paragraphs. +- ![](../assets/en/WritePro/wp-multi-level-list-button5.png) Decrease the list level of selected paragraphs. +- ![](../assets/en/WritePro/wp-multi-level-list-button6.png) Append a level to the list and create a new sub-level. +- ![](../assets/en/WritePro/wp-multi-level-list7.png) Modify numbering formats. +- ![](../assets/en/WritePro/wp-multi-level-list-button8.png) Concatenate numbering markers between levels. + +### Creating a style sheet + +To create a multi-level list style sheet you can either: + +- Select and apply one of the predefined templates to the paragraph(s), the selected template and all it sub-levels are then displayed on the top part of the sytle sheets panel. You can customize its levels and formatting (such as numbering styles, colors, fonts, or hierarchy), and then create a new style sheet based on the resulting selection. + +- Duplicate one of the existing style sheets via the Duplicate option in the ![](../assets/en/WritePro/wp-multi-level-list-button1.png) bottom menu. + +- Click the ![](../assets/en/WritePro/wp-multi-level-list-button1.png) button and then "New style sheet based on selection" after having selected paragraph(s) to use for the style sheet according to the following: + - If the selected paragraph(s) use(s) a list marker, a new multi-level list style sheet made of one level is created based on the current formatting. + - If the selected paragraph(s) already use(s) a root-level or a sub-level of a multi-level list style sheet, the complete hierarchy is duplicated. + +:::note + +For detailed information about creating and configuring multi-level list style sheets by programming, see [Multi-level list style sheets](./user-legacy/stylesheets.md#multi-level-list-style-sheets). + +::: + +### Applying a multi-level list + +You can apply either a multi-level list style sheet defined in the document or one of the predefined templates to the selected paragraphs using the Style Sheets panel: + +![](../assets/en/WritePro/wp-multi-level-list-panel2.png) + +### Predefined templates + +The interface provides the following predefined multi-level list templates: + +**Technical Blueprint** + +Level 1: 1 +Level 2: 1.1 +Level 3: 1.1.1 +Level 4: 1.1.1.1 +Level 5: 1.1.1.1.1 + +**Legal & Governance** + +Level 1: I. +Level 2: A. +Level 3: 1. +Level 4: a) +Level 5: (1) +Level 6: (a) +Level 7: (i) + +**Educational Material** + +Level 1: I. +Level 2: 1. +Level 3: 1.1. +Level 4: a. +Level 5: ● + +**Meeting Minutes** + +Level 1: 1. +Level 2: ● + +**Visual Hierarchy** + +Level 1: ♣ (Club) +Level 2: ♦ (Diamond) +Level 3: ■ (Square) +Level 4: □ (Hollow Square) +Level 5: ● (Disc) +Level 6: ○ (Circle) +Level 7: – (Dash) + +### Customizing predefined templates + +You can customize the available templates to provide users with predefined multi-level lists that match the needs of your application. + +The predefined multi-level list templates are defined in a JSON file named `multiLevelStyles.json`. This file is located in the 4D Write Pro Interface component Resources folder. + +You can customize the available templates by adding your own `multiLevelStyles.json` file in either: + +- the project's local Resources folder directly, +- a `4D WritePro Interface` folder located within the project Resources folder. + +If a `multiLevelStyles.json` file is present in both locations, the file located in the `4D WritePro Interface` folder takes precedence. + +Each template definition includes: + +- a template name, +- one or more list levels, +- the 4D Write Pro attributes applied to each level. Any 4D Write Pro attribute can be used in a template definition. + +You can use either the attribute names or the corresponding 4D Write Pro constants as JSON keys and values. +For example, the following definitions are equivalent: + +- `"listStyleType": "wk upper roman"` +- `"wk list style type": "wk upper roman"` + +#### 例題 + +Example of a customized JSON file: + +```json +{ + "predefinedMultiLevelLists": [ + { + "name": "Technical Blue Print Updated", + "levels": [ + { "listStyleType": "wk decimal" }, + { "listStyleType": "wk decimal", "listConcatStringFormat": true } + ] + } + ] +} +``` + +### 参照 + +- [Related blog post: Multi-Level Style Sheets in 4D Write Pro: Now With a Dedicated UI](https://blog.4d.com/multi-level-style-sheets-in-4d-write-pro-now-with-a-dedicated-ui) +- [multi-level list style sheets](./user-legacy/stylesheets.md#multi-level-list-style-sheets) +- [multi-level lists](.user-legacy/using-a-4d-write-pro-area.md#multi-level-lists) \ No newline at end of file diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button.png b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button.png new file mode 100644 index 00000000000000..5f8e7ee323f616 Binary files /dev/null and b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button.png differ diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button1.png b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button1.png new file mode 100644 index 00000000000000..07da3e87098960 Binary files /dev/null and b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button1.png differ diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button2.png b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button2.png new file mode 100644 index 00000000000000..088e4c64ed531e Binary files /dev/null and b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button2.png differ diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button3.png b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button3.png new file mode 100644 index 00000000000000..ddda09768ac90f Binary files /dev/null and b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button3.png differ diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button4.png b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button4.png new file mode 100644 index 00000000000000..aadcadc4745659 Binary files /dev/null and b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button4.png differ diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button5.png b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button5.png new file mode 100644 index 00000000000000..7de845916f4a1f Binary files /dev/null and b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button5.png differ diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button6.png b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button6.png new file mode 100644 index 00000000000000..636cb5780823cd Binary files /dev/null and b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button6.png differ diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button8.png b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button8.png new file mode 100644 index 00000000000000..0d5031837e8773 Binary files /dev/null and b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button8.png differ diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel.png b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel.png new file mode 100644 index 00000000000000..652d71520d5fe7 Binary files /dev/null and b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel.png differ diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel2.png b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel2.png new file mode 100644 index 00000000000000..6e3c56f16b0d7a Binary files /dev/null and b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel2.png differ diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets1.png b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets1.png new file mode 100644 index 00000000000000..10c1d6e47429a9 Binary files /dev/null and b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets1.png differ diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets2.png b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets2.png new file mode 100644 index 00000000000000..a0d750f5bd4f62 Binary files /dev/null and b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets2.png differ diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list7.png b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list7.png new file mode 100644 index 00000000000000..646a3d751ced01 Binary files /dev/null and b/i18n/ja/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list7.png differ diff --git a/i18n/ja/docusaurus-plugin-content-docs/version-21-R3/API/DataClassClass.md b/i18n/ja/docusaurus-plugin-content-docs/version-21-R3/API/DataClassClass.md index 78284f4af38967..e2ab97c1a83c3d 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/version-21-R3/API/DataClassClass.md +++ b/i18n/ja/docusaurus-plugin-content-docs/version-21-R3/API/DataClassClass.md @@ -1222,11 +1222,11 @@ $es:=ds.Movie.query("roles.actor.lastName = :1 AND roles.actor{2}.lastName = :2" この場合、*value* 引数は、以下のプロパティを格納した**比較ベクトルオブジェクト** である必要があります: -| プロパティ | 型 | 説明 | -| --------- | -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| vector | [4D.Vector](../API/VectorClass.md) | 必須設定です。 比較するベクトル | -| metric | Text | 任意。 クエリに使用する[ベクトル計算](../API/VectorClass.md#ことなるベクトル計算を理解する)。 以下の(テキスト)定数のいずれか一つを使用できます:
  • `mk cosine` (省略時のデフォルト): ベクトル間のコサイン類似度を計算します。
  • `mk dot`: ベクトルのドット類似度を計算します。
  • `mk euclidean`: ベクトル間のユークリッド距離を計算します。 | -| threshold | Real | 任意(デフォルト: 0.5)。 選択された"metric"に従って、コサイン、ドット、またはユークリッド類似度に基づいたベクトル比較をフィルタリングするために使用されるしきい値。 最適な結果を得るためには、特定の用途に最適な類似度のしきい値をきちんと選択することが強く推奨されます。 | +| プロパティ | 型 | 説明 | +| --------- | -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| vector | [4D.Vector](../API/VectorClass.md) | 必須設定です。 比較するベクトル | +| metric | Text | 任意。 クエリに使用する[ベクトル計算](../API/VectorClass.md#ことなるベクトル計算を理解する)。 You can use one of the following (Text) constants:
  • `mk cosine` (default if omitted): calculates the [cosine similarity](./VectorClass.md#cosinesimilarity) between vectors.
  • `mk dot`: calculates the [dot similarity](VectorClass.md#dotsimilarity) of vectors.
  • `mk euclidean`: calculates the [Euclidean distance](./VectorClass.md#euclideandistance) between vectors. | +| threshold | Real | 任意(デフォルト: 0.5)。 選択された"metric"に従って、コサイン、ドット、またはユークリッド類似度に基づいたベクトル比較をフィルタリングするために使用されるしきい値。 最適な結果を得るためには、特定の用途に最適な類似度のしきい値をきちんと選択することが強く推奨されます。 | **comparator** 記号の、一部のみがサポートされます。 これらの比較記号は、結果としきい値を比較するのに使用されるという点に注意してください: @@ -1241,8 +1241,8 @@ $es:=ds.Movie.query("roles.actor.lastName = :1 AND roles.actor{2}.lastName = :2" ```4d var $myVector : 4D.Vector -$myVector := getVector //(例: 4D.AIKit などから)ベクトルを取得するメソッド -var $comparisonVector := {vector: $myVector; metric: mk euclidean; threshold: 1.2} +$myVector := getVector //method to get a vector, e.g. from 4D.AIKit +var $comparisonVector := {vector: $myVector; metric: mk cosine; threshold: 1.2} var $results := ds.MyClass.query("myVectorField <= :1"; $comparisonVector) ``` @@ -1250,20 +1250,24 @@ var $results := ds.MyClass.query("myVectorField <= :1"; $comparisonVector) ```4d var $results := ds.MyClass.query("myVectorField > :1 order by myVectorField desc"; $comparisonVector) - //the first entity is the most similar + //$results.first() entity is the most similar ``` :::note -The default order is ascending, although a descending order is usually the most useful for vector similarity queries. Thus, you will usually have to add the `desc` keyword in your vector similarity query strings. +You will generally want vector similarity query results to be sorted from "most similar" to "least similar." By default, results returned with an **order by** clause are sorted in ascending order. Depending on the similarity metric used, you may need to adjust the sorting direction to obtain the correct ranking: + +- for [**cosine**](./VectorClass.md#cosinesimilarity) and [**dot**](./VectorClass.md#dotsimilarity) similarity, higher values indicate greater similarity. Therefore, you will typically need to include the `desc` keyword in the query string. +- for [**euclidean distance**](./VectorClass.md#euclideandistance) similarity, lower values indicate greater similarity. In this case, the default ascending order (or explicitly using the `asc` keyword) is appropriate. ::: -同じベクトルがクエリ文字列内に複数回出現した場合、order by は最初のものの結果に適用されます。例: +You can only order on a single vector field. 同じベクトルがクエリ文字列内に複数回出現した場合、order by は最初のものの結果に適用されます。例: ```4d var $results := ds.MyClass.query("myVectorField > :1 and myVectorField > :2 order by myVectorField desc"; / - {vector : $myVector1 };{vector : $myVector2 }) //myVectorField > :1 is used for the order by + {vector : $myVector1 };{vector : $myVector2 }) + //myVectorField > :1 is used for the order by ``` 詳細については[以下の例題](#例題-4-2)を参照してください (例題 4 と 5)。 @@ -1271,6 +1275,7 @@ var $results := ds.MyClass.query("myVectorField > :1 and myVectorField > :2 orde :::tip 関連したblog 記事 - [4D AI: Searching Entities by Vector Similarity in 4D](https://blog.4d.com/4d-ai-searching-entities-by-vector-similarity-in-4d) +- [4D AI: Sorting Query Results by Vector Similarity](https://blog.4d.com/4d-ai-sorting-query-results-by-vector-similarity/) - [Why Your Search Stack Feels Broken — and How Vector Search Fixes It](https://blog.4d.com/why-your-search-stack-feels-broken-and-how-vector-search-fixes-it) ::: @@ -1637,30 +1642,29 @@ var $client:=cs.AIKit.OpenAI.new("my api key") var $result:=$client.embeddings.create("my long text to search"; "text-embedding-ada-002") var $vector:=$result.vector - // embedding 属性は4D.Vector クラスオブジェクトを格納した4D フィールドに基づいています - // デフォルトのmetric (コサイン)での検索 -var $employees:=ds.Employee.query("embedding > :1"; {vector : $vector}) - // ユークリッド計量での検索 -var $employees:=ds.Employee.query("embedding > :1"; {vector: $vector; metric: mk euclidean}) - // 明示的にコサイン計量を指定し、カスタムのしきい値を用いた検索 -var $employees:=ds.Employee.query("embedding > :1"; {vector: $vector; metric: mk cosine; threshold: 0.9}) - // フォーミュラを使用した検索 -var $employees:=ds.Employee.query(Formula(This.embedding.cosineSimilarity($vector)>0.9)) + //embedding attribute is based upon a 4D field storing 4D.Vector class objects + + //search with default metric (cosine) +var $employees:=ds.Employee.query("embedding > :1 order by embedding desc"; {vector : $vector}) + + //search with euclidean metric +var $employees:=ds.Employee.query("embedding < :1 order by embedding"; {vector: $vector; metric: mk euclidean}) + + //search with explicit cosine metric and custom threshold +var $employees:=ds.Employee.query("embedding > :1 order by embedding desc"; {vector: $vector; metric: mk cosine; threshold: 0.9}) + + //search with a formula +var $employees:=ds.Employee.query(Formula(This.embdedding.cosineSimilarity($vector)>0.9)) ``` #### 例題 5 -異なるメトリックでのベクトルを使用したベクトル類似度によるクエリを実行し、コサイン類似度で結果を並べ替えたい場合を考えます: +Vector-based semantic ordering can be combined with traditional ORDA filters in the same query. ```4d - // 比較ベクトルを作成 -var $vector1Comparison:={vector: $myvector; metric: mk cosine; threshold: 0.4} -var $vector2Comparison:={vector: $myvector; metric: mk euclidean; threshold:1} - - // embedding 属性は、4D.Vector クラスオブジェクトを格納している4D フィールドに基づいています -ds.VectorTable.query("embedding>:1 and embedding<:2";$vector1Comparison;$vector2Comparison)\ - .orderByFormula(Formula(This.embedding.cosineSimilarity($vector1Comparison))) +var $comparisonVector := {vector: $myVector; metric: mk cosine; threshold: 0.4} +var $results := ds.MyTable.query("myVectorField <= :1 AND salary>100000 order by myVectorField, salary desc"; $comparisonVector) ``` #### 参照 diff --git a/i18n/pt/docusaurus-plugin-content-docs/current/API/DataClassClass.md b/i18n/pt/docusaurus-plugin-content-docs/current/API/DataClassClass.md index cd7b19859804d8..a86c22d35af198 100644 --- a/i18n/pt/docusaurus-plugin-content-docs/current/API/DataClassClass.md +++ b/i18n/pt/docusaurus-plugin-content-docs/current/API/DataClassClass.md @@ -1217,11 +1217,11 @@ If *attributePath* designates an attribute storing [**vector objects**](../API/V In this case, the *value* parameter must be a **comparison vector object** containing the following properties: -| Propriedade | Tipo | Descrição | -| ----------- | -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| vector | [4D.Vector](../API/VectorClass.md) | Obrigatório. The vector to be compared | -| metric | Text | Opcional. [Vector computation](../API/VectorClass.md#understanding-the-different-vector-computations) to use for the query. You can use one of the following (Text) constants:
  • `mk cosine` (default if omitted): calculates the cosine similarity between vectors.
  • `mk dot`: calculates the dot similarity of vectors.
  • `mk euclidean`: calculates the Euclidean distance between vectors. | -| threshold | Real | Optional (default: 0.5). A threshold value used to filter vector comparisons based on their cosine, dot or euclidean similarity score according to the selected "metric". It is highly recommended to choose a similarity that best fits your specific use case for optimal results. | +| Propriedade | Tipo | Descrição | +| ----------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| vector | [4D.Vector](../API/VectorClass.md) | Obrigatório. The vector to be compared | +| metric | Text | Opcional. [Vector computation](../API/VectorClass.md#understanding-the-different-vector-computations) to use for the query. You can use one of the following (Text) constants:
  • `mk cosine` (default if omitted): calculates the [cosine similarity](./VectorClass.md#cosinesimilarity) between vectors.
  • `mk dot`: calculates the [dot similarity](VectorClass.md#dotsimilarity) of vectors.
  • `mk euclidean`: calculates the [Euclidean distance](./VectorClass.md#euclideandistance) between vectors. | +| threshold | Real | Optional (default: 0.5). A threshold value used to filter vector comparisons based on their cosine, dot or euclidean similarity score according to the selected "metric". It is highly recommended to choose a similarity that best fits your specific use case for optimal results. | Only a subset of **comparator** symbols are supported. Note that they compare results to the threshold value: @@ -1237,7 +1237,7 @@ For example, you want to return entities of MyClass where the similarity with a ```4d var $myVector : 4D.Vector $myVector := getVector //method to get a vector, e.g. from 4D.AIKit -var $comparisonVector := {vector: $myVector; metric: mk euclidean; threshold: 1.2} +var $comparisonVector := {vector: $myVector; metric: mk cosine; threshold: 1.2} var $results := ds.MyClass.query("myVectorField <= :1"; $comparisonVector) ``` @@ -1245,20 +1245,24 @@ The **order by** statement is supported in the query string so that entities in ```4d var $results := ds.MyClass.query("myVectorField > :1 order by myVectorField desc"; $comparisonVector) - //the first entity is the most similar + //$results.first() entity is the most similar ``` :::note -The default order is ascending, although a descending order is usually the most useful for vector similarity queries. Thus, you will usually have to add the `desc` keyword in your vector similarity query strings. +You will generally want vector similarity query results to be sorted from "most similar" to "least similar." By default, results returned with an **order by** clause are sorted in ascending order. Depending on the similarity metric used, you may need to adjust the sorting direction to obtain the correct ranking: + +- for [**cosine**](./VectorClass.md#cosinesimilarity) and [**dot**](./VectorClass.md#dotsimilarity) similarity, higher values indicate greater similarity. Therefore, you will typically need to include the `desc` keyword in the query string. +- for [**euclidean distance**](./VectorClass.md#euclideandistance) similarity, lower values indicate greater similarity. In this case, the default ascending order (or explicitly using the `asc` keyword) is appropriate. ::: -If the same vector appears multiple times in the query string, the order by will be applied to the results of the first one, for example: +You can only order on a single vector field. If the same vector appears multiple times in the query string, the order by will be applied to the results of the first one, for example: ```4d var $results := ds.MyClass.query("myVectorField > :1 and myVectorField > :2 order by myVectorField desc"; / - {vector : $myVector1 };{vector : $myVector2 }) //myVectorField > :1 is used for the order by + {vector : $myVector1 };{vector : $myVector2 }) + //myVectorField > :1 is used for the order by ``` See [more examples below](#example-4-2) (examples 4 and 5). @@ -1266,6 +1270,7 @@ See [more examples below](#example-4-2) (examples 4 and 5). :::tip Related blog posts - [4D AI: Searching Entities by Vector Similarity in 4D](https://blog.4d.com/4d-ai-searching-entities-by-vector-similarity-in-4d) +- [4D AI: Sorting Query Results by Vector Similarity](https://blog.4d.com/4d-ai-sorting-query-results-by-vector-similarity/) - [Why Your Search Stack Feels Broken — and How Vector Search Fixes It](https://blog.4d.com/why-your-search-stack-feels-broken-and-how-vector-search-fixes-it) ::: @@ -1633,12 +1638,16 @@ var $result:=$client.embeddings.create("my long text to search"; "text-embedding var $vector:=$result.vector //embedding attribute is based upon a 4D field storing 4D.Vector class objects + //search with default metric (cosine) -var $employees:=ds.Employee.query("embedding > :1"; {vector : $vector}) +var $employees:=ds.Employee.query("embedding > :1 order by embedding desc"; {vector : $vector}) + //search with euclidean metric -var $employees:=ds.Employee.query("embedding > :1"; {vector: $vector; metric: mk euclidean}) +var $employees:=ds.Employee.query("embedding < :1 order by embedding"; {vector: $vector; metric: mk euclidean}) + //search with explicit cosine metric and custom threshold -var $employees:=ds.Employee.query("embedding > :1"; {vector: $vector; metric: mk cosine; threshold: 0.9}) +var $employees:=ds.Employee.query("embedding > :1 order by embedding desc"; {vector: $vector; metric: mk cosine; threshold: 0.9}) + //search with a formula var $employees:=ds.Employee.query(Formula(This.embdedding.cosineSimilarity($vector)>0.9)) @@ -1646,17 +1655,11 @@ var $employees:=ds.Employee.query(Formula(This.embdedding.cosineSimilarity($vect #### Exemplo 2 -We want to execute a query by vector similarity using vectors with different metrics and order the results by cosine similarity: +Vector-based semantic ordering can be combined with traditional ORDA filters in the same query. ```4d - //Create the comparison vectors -var $vector1Comparison:={vector: $myvector; metric: mk cosine; threshold: 0.4} -var $vector2Comparison:={vector: $myvector; metric: mk euclidean; threshold:1} - - //embedding attribute is based upon a 4D field storing 4D.Vector class objects -ds.VectorTable.query("embedding>:1 and embedding<:2";$vector1Comparison;$vector2Comparison)\ - .orderByFormula(Formula(This.embedding.cosineSimilarity($vector1Comparison))) - +var $comparisonVector := {vector: $myVector; metric: mk cosine; threshold: 0.4} +var $results := ds.MyTable.query("myVectorField <= :1 AND salary>100000 order by myVectorField, salary desc"; $comparisonVector) ``` #### Veja também diff --git a/i18n/pt/docusaurus-plugin-content-docs/current/Notes/updates.md b/i18n/pt/docusaurus-plugin-content-docs/current/Notes/updates.md index 95f6d84ac4c421..05d0f8def1e469 100644 --- a/i18n/pt/docusaurus-plugin-content-docs/current/Notes/updates.md +++ b/i18n/pt/docusaurus-plugin-content-docs/current/Notes/updates.md @@ -9,7 +9,8 @@ Leia [**O que há de novo no 4D v21 R4**](https://blog.4d.com/whats-new-in-4d-21 #### Destaques -- New [`defer`](../commands/defer) command to declare some code to be always executed at method or function exit. +- Multi-level list style sheets are now [supported in 4D Write Pro Interface](../WritePro/writeprointerface.md#multi-level-style-sheets), allowing users to create and manage structured multi-level lists directly from the toolbar and sidebar. +- New [`defer`](../commands/defer) command to declare some code to be always executed at method or function exit; new [`Deferred formulas`](../commands/deferred-formulas) command to get the list of deferred formulas. ## 4D 21 R3 @@ -18,7 +19,7 @@ Leia [**O que há de novo no 4D v21 R3**](https://blog.4d.com/whats-new-in-4d-21 #### Destaques - The [`JSON Validate`](../commands/json-validate) command now supports of JSON Schema draft 2020-12. -- 4D Write Pro now supports [hierarchical list style sheets](../WritePro/user-legacy/stylesheets.md#hierarchical-list-style-sheets), enabling the creation and management of structured [multi-level lists](../WritePro/user-legacy/using-a-4d-write-pro-area.md#multi-level-lists) with automatic numbering. +- 4D Write Pro now supports [multi-level list style sheets](../WritePro/user-legacy/stylesheets.md#multi-level-list-style-sheets), enabling the creation and management of structured [multi-level lists](../WritePro/user-legacy/using-a-4d-write-pro-area.md#multi-level-lists) with automatic numbering. - Ability to use a custom certificate from the macOS keychain instead of a local certificates folder in [`HTTPRequest`](../API/HTTPRequestClass.md#4dhttprequestnew) and [`HTTPAgent`](../API/HTTPAgentClass.md#4dhttpagentnew) classes. - New [`4D.Method` class](../API/MethodClass.md) to create and execute a 4D method code from text source. [`METHOD Get path`](../commands/method-get-path) and [`METHOD RESOLVE PATH`](../commands/method-resolve-path) commands support a new `path volatile method` constant (128). - IMAP transporter now supports mailbox event notifications using the IDLE protocol through a [notifier object](../API/IMAPTransporterClass.md#notifier) of the [4D.IMAPNotifier](../API/IMAPNotifierClass.md) class, configurable via the `listener` property of [IMAP New transporter](../commands/imap-new-transporter). diff --git a/i18n/pt/docusaurus-plugin-content-docs/current/WritePro/user/user-new.md b/i18n/pt/docusaurus-plugin-content-docs/current/WritePro/user/user-new.md index 1b9160d78a4b70..2884595d9436a5 100644 --- a/i18n/pt/docusaurus-plugin-content-docs/current/WritePro/user/user-new.md +++ b/i18n/pt/docusaurus-plugin-content-docs/current/WritePro/user/user-new.md @@ -10,7 +10,7 @@ to import ## Listas -4D Write Pro supports flat lists (single-level) and hierarchical lists (multi-level). +4D Write Pro supports flat lists (single-level) and multi-level lists. ### Single-level lists @@ -39,7 +39,7 @@ When the list is created using [the WP SET ATTRIBUTE command](../commands-legacy ### Multi-level lists -Multi-level lists are based on [hierarchical list style sheets](../user-legacy/stylesheets.md#hierarchical-list-style-sheets). Multi-level lists contain a root-level style sheet and one or more sub-level style sheet(s). Each level is attached to a hierarchical list style sheet and represents a depth in the list (level 1, level 2, level 3, etc.). +Multi-level lists are based on [multi-level list style sheets](../user-legacy/stylesheets.md#multi-level-list-style-sheets). Multi-level lists contain a root-level style sheet and one or more sub-level style sheet(s). Each level is attached to a multi-level list style sheet and represents a depth in the list (level 1, level 2, level 3, etc.). When a new sub-level is created, the level numbering restarts at 1. When you add or remove an element in your multi-level list, the numbers are automatically adjusted. @@ -55,30 +55,30 @@ Multi-level lists can be managed using: :::tip Related blog post -[4D Write Pro – Creating Multi-level Bullet or Numbered Lists Using Hierarchical list Style Sheets](https://blog.4d.com/4d-write-pro-creating-multi-level-bullet-or-numbered-lists-using-hierarchical-paragraph-style-sheets) +[4D Write Pro – Creating Multi-level Bullet or Numbered Lists Using Multi-level list Style Sheets](https://blog.4d.com/4d-write-pro-creating-multi-level-bullet-or-numbered-lists-using-multi-level-paragraph-style-sheets) ::: - + -## Hierarchical list style sheets +## Multi-level list style sheets -Hierarchical list style sheets are used to create [multi-level lists](../user-legacy/using-a-4d-write-pro-area.md#multi-level-lists). +Multi-level list style sheets are used to create [multi-level lists](../user-legacy/using-a-4d-write-pro-area.md#multi-level-lists). -To create a hierarchical list style sheet, use [WP New style sheet](../commands/wp-new-style-sheet.md) and pass in *listLevelCount* the desired number of levels. You then define a hierarchy of related paragraph style sheets: one **root-level** style sheet and one or more **sub-level** style sheets linked to it. Each level represents a depth in the list (level 1, level 2, level 3, etc.) and is automatically named "root-level name + lvl + index", for example "Mylist lvl 2". +To create a multi-level list style sheet, use [WP New style sheet](../commands/wp-new-style-sheet.md) and pass in *listLevelCount* the desired number of levels. You then define a hierarchy of related paragraph style sheets: one **root-level** style sheet and one or more **sub-level** style sheets linked to it. Each level represents a depth in the list (level 1, level 2, level 3, etc.) and is automatically named "root-level name + lvl + index", for example "Mylist lvl 2". -To customize hierarchical list styles, the paragraph style sheet object can be customized using [style sheet attributes](../commands-legacy/4d-write-pro-attributes.md#style-sheets). +To customize multi-level list styles, the paragraph style sheet object can be customized using [style sheet attributes](../commands-legacy/4d-write-pro-attributes.md#style-sheets). -Hierarchical list style sheets are fully supported by the following commands: [`WP Get style sheet`](../commands/wp-get-style-sheet.md), [`WP SET ATTRIBUTES`](../commands/wp-set-attributes.md), [`WP DELETE STYLE SHEET`](../commands/wp-delete-style-sheet.md). +Multi-level list style sheets are fully supported by the following commands: [`WP Get style sheet`](../commands/wp-get-style-sheet.md), [`WP SET ATTRIBUTES`](../commands/wp-set-attributes.md), [`WP DELETE STYLE SHEET`](../commands/wp-delete-style-sheet.md). ### Exemplo -The following example creates a three-level hierarchical list style sheet and applies it to paragraphs. +The following example creates a three-level multi-level list style sheet and applies it to paragraphs. ```4d -// Create 3 hierarchical list style sheets +// Create 3 multi-level list style sheets WP New style sheet(wpArea; wk type paragraph; "MyList"; 3) // Retrieve each level @@ -92,7 +92,7 @@ WP SET ATTRIBUTES($level1; {listStyleType: wk upper latin; fontBold: wk true}) WP SET ATTRIBUTES($level2; {listConcatStringFormat: True}) WP SET ATTRIBUTES($level3; {listStringFormatLtr: "(#)"}) -// Apply hierarchical style sheets to paragraphs +// Apply multi-level style sheets to paragraphs var $paragraphs : Collection $paragraphs:=WP Get elements(wpArea; wk type paragraph) @@ -103,7 +103,7 @@ WP SET ATTRIBUTES($paragraphs[2]; wk style sheet; $level3) result: -![](../../assets/en/WritePro/hierarchical-paragraph-stylesheets-1.png) +![](../../assets/en/WritePro/multi-level-paragraph-stylesheets-1.png) To delete the first sub-leve: @@ -113,11 +113,11 @@ WP DELETE STYLE SHEET(wpArea; "MyList"; 2) result: -![](../../assets/en/WritePro/hierarchical-paragraph-stylesheets-2.png) +![](../../assets/en/WritePro/multi-level-paragraph-stylesheets-2.png) ### Predefined attribute values -When created, hierarchical list style sheets use predefined values: +When created, multi-level list style sheets use predefined values: - `wk margin left` = 0.75 cm \* (number of previous levels) or 0.25 inches \* (number of previous levels), depending on current layout unit - `wk list type` = `wk decimal` diff --git a/i18n/pt/docusaurus-plugin-content-docs/current/WritePro/writeprointerface.md b/i18n/pt/docusaurus-plugin-content-docs/current/WritePro/writeprointerface.md index e2f9f7c9aa33df..bded445d0ef956 100644 --- a/i18n/pt/docusaurus-plugin-content-docs/current/WritePro/writeprointerface.md +++ b/i18n/pt/docusaurus-plugin-content-docs/current/WritePro/writeprointerface.md @@ -1,8 +1,8 @@ ---- +d--- id: writeprointerface -title: Interface 4D Write Pro +title: 4D Write Pro Interface slug: /WritePro/write-pro-interface ---- +--------------------------------------------------- 4D Write Pro Interface offers a set of palettes, which allow end users to easily customize a 4D Write Pro document. @@ -411,3 +411,154 @@ The History area lists all your prompts sent to the AI. You can hide/show this a The Erase button allows you to reset the whole window and erase all interactions. It is equivalent to close/reopen the AI dialog box. +## Multi-level list style sheets + +4D Write Pro Interface allows users to create and manage [multi-level lists](./user-legacy/using-a-4d-write-pro-area.md#multi-level-lists) directly from both the toolbar and widget sidebar. + +**Toolbar:** + +![](../assets/en/WritePro/wp-multi-level-list-stylesheets1.png) + +**Sidebar:** + +![](../assets/en/WritePro/wp-multi-level-list-stylesheets2.png) + +To manage multi-level list style sheets, click the ![](../assets/en/WritePro/wp-multi-level-list-button.png) multi-level list button. + +When the multi-level list mode is enabled, the Style Sheets panel displays the [multi-level list style sheets](./user-legacy/stylesheets.md#multi-level-list-style-sheets) defined in the document as well as [predefined templates](#predefined-templates). + +![](../assets/en/WritePro/wp-multi-level-list-panel.png) + +### Managing multi-level style sheets + +The Style Sheets panel allows you in general to: + +- ![](../assets/en/WritePro/wp-multi-level-list-button1.png) Create a new style sheet. +- ![](../assets/en/WritePro/wp-multi-level-list-button2.png) Delete a style sheet. +- ![](../assets/en/WritePro/wp-multi-level-list-button3.png) Update a style sheet. + +Once a multi-level list style sheet is selected, the panel provides also tools to manage the hierarchy and numbering of the list: + +- ![](../assets/en/WritePro/wp-multi-level-list-button4.png) Increase the list level of selected paragraphs. +- ![](../assets/en/WritePro/wp-multi-level-list-button5.png) Decrease the list level of selected paragraphs. +- ![](../assets/en/WritePro/wp-multi-level-list-button6.png) Append a level to the list and create a new sub-level. +- ![](../assets/en/WritePro/wp-multi-level-list7.png) Modify numbering formats. +- ![](../assets/en/WritePro/wp-multi-level-list-button8.png) Concatenate numbering markers between levels. + +### Creating a style sheet + +To create a multi-level list style sheet you can either: + +- Select and apply one of the predefined templates to the paragraph(s), the selected template and all it sub-levels are then displayed on the top part of the sytle sheets panel. You can customize its levels and formatting (such as numbering styles, colors, fonts, or hierarchy), and then create a new style sheet based on the resulting selection. + +- Duplicate one of the existing style sheets via the Duplicate option in the ![](../assets/en/WritePro/wp-multi-level-list-button1.png) bottom menu. + +- Click the ![](../assets/en/WritePro/wp-multi-level-list-button1.png) button and then "New style sheet based on selection" after having selected paragraph(s) to use for the style sheet according to the following: + - If the selected paragraph(s) use(s) a list marker, a new multi-level list style sheet made of one level is created based on the current formatting. + - If the selected paragraph(s) already use(s) a root-level or a sub-level of a multi-level list style sheet, the complete hierarchy is duplicated. + +:::note + +For detailed information about creating and configuring multi-level list style sheets by programming, see [Multi-level list style sheets](./user-legacy/stylesheets.md#multi-level-list-style-sheets). + +::: + +### Applying a multi-level list + +You can apply either a multi-level list style sheet defined in the document or one of the predefined templates to the selected paragraphs using the Style Sheets panel: + +![](../assets/en/WritePro/wp-multi-level-list-panel2.png) + +### Predefined templates + +The interface provides the following predefined multi-level list templates: + +**Technical Blueprint** + +Level 1: 1 +Level 2: 1.1 +Level 3: 1.1.1 +Level 4: 1.1.1.1 +Level 5: 1.1.1.1.1 + +**Legal & Governance** + +Level 1: I. +Level 2: A. +Level 3: 1. +Level 4: a) +Level 5: (1) +Level 6: (a) +Level 7: (i) + +**Educational Material** + +Level 1: I. +Level 2: 1. +Level 3: 1.1. +Level 4: a. +Level 5: ● + +**Meeting Minutes** + +Level 1: 1. +Level 2: ● + +**Visual Hierarchy** + +Level 1: ♣ (Club) +Level 2: ♦ (Diamond) +Level 3: ■ (Square) +Level 4: □ (Hollow Square) +Level 5: ● (Disc) +Level 6: ○ (Circle) +Level 7: – (Dash) + +### Customizing predefined templates + +You can customize the available templates to provide users with predefined multi-level lists that match the needs of your application. + +The predefined multi-level list templates are defined in a JSON file named `multiLevelStyles.json`. This file is located in the 4D Write Pro Interface component Resources folder. + +You can customize the available templates by adding your own `multiLevelStyles.json` file in either: + +- the project's local Resources folder directly, +- a `4D WritePro Interface` folder located within the project Resources folder. + +If a `multiLevelStyles.json` file is present in both locations, the file located in the `4D WritePro Interface` folder takes precedence. + +Each template definition includes: + +- a template name, +- one or more list levels, +- the 4D Write Pro attributes applied to each level. Any 4D Write Pro attribute can be used in a template definition. + +You can use either the attribute names or the corresponding 4D Write Pro constants as JSON keys and values. +For example, the following definitions are equivalent: + +- `"listStyleType": "wk upper roman"` +- `"wk list style type": "wk upper roman"` + +#### Exemplo + +Example of a customized JSON file: + +```json +{ + "predefinedMultiLevelLists": [ + { + "name": "Technical Blue Print Updated", + "levels": [ + { "listStyleType": "wk decimal" }, + { "listStyleType": "wk decimal", "listConcatStringFormat": true } + ] + } + ] +} +``` + +### Veja também + +- [Related blog post: Multi-Level Style Sheets in 4D Write Pro: Now With a Dedicated UI](https://blog.4d.com/multi-level-style-sheets-in-4d-write-pro-now-with-a-dedicated-ui) +- [multi-level list style sheets](./user-legacy/stylesheets.md#multi-level-list-style-sheets) +- [multi-level lists](.user-legacy/using-a-4d-write-pro-area.md#multi-level-lists) \ No newline at end of file diff --git a/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button.png b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button.png new file mode 100644 index 00000000000000..5f8e7ee323f616 Binary files /dev/null and b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button.png differ diff --git a/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button1.png b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button1.png new file mode 100644 index 00000000000000..07da3e87098960 Binary files /dev/null and b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button1.png differ diff --git a/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button2.png b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button2.png new file mode 100644 index 00000000000000..088e4c64ed531e Binary files /dev/null and b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button2.png differ diff --git a/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button3.png b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button3.png new file mode 100644 index 00000000000000..ddda09768ac90f Binary files /dev/null and b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button3.png differ diff --git a/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button4.png b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button4.png new file mode 100644 index 00000000000000..aadcadc4745659 Binary files /dev/null and b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button4.png differ diff --git a/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button5.png b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button5.png new file mode 100644 index 00000000000000..7de845916f4a1f Binary files /dev/null and b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button5.png differ diff --git a/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button6.png b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button6.png new file mode 100644 index 00000000000000..636cb5780823cd Binary files /dev/null and b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button6.png differ diff --git a/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button8.png b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button8.png new file mode 100644 index 00000000000000..0d5031837e8773 Binary files /dev/null and b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-button8.png differ diff --git a/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel.png b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel.png new file mode 100644 index 00000000000000..652d71520d5fe7 Binary files /dev/null and b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel.png differ diff --git a/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel2.png b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel2.png new file mode 100644 index 00000000000000..6e3c56f16b0d7a Binary files /dev/null and b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-panel2.png differ diff --git a/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets1.png b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets1.png new file mode 100644 index 00000000000000..10c1d6e47429a9 Binary files /dev/null and b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets1.png differ diff --git a/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets2.png b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets2.png new file mode 100644 index 00000000000000..a0d750f5bd4f62 Binary files /dev/null and b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list-stylesheets2.png differ diff --git a/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list7.png b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list7.png new file mode 100644 index 00000000000000..646a3d751ced01 Binary files /dev/null and b/i18n/pt/docusaurus-plugin-content-docs/current/assets/en/WritePro/wp-multi-level-list7.png differ diff --git a/i18n/pt/docusaurus-plugin-content-docs/version-21-R3/API/DataClassClass.md b/i18n/pt/docusaurus-plugin-content-docs/version-21-R3/API/DataClassClass.md index ff33a1384ce429..34d2d77ab845ca 100644 --- a/i18n/pt/docusaurus-plugin-content-docs/version-21-R3/API/DataClassClass.md +++ b/i18n/pt/docusaurus-plugin-content-docs/version-21-R3/API/DataClassClass.md @@ -1217,11 +1217,11 @@ If *attributePath* designates an attribute storing [**vector objects**](../API/V In this case, the *value* parameter must be a **comparison vector object** containing the following properties: -| Propriedade | Tipo | Descrição | -| ----------- | -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| vector | [4D.Vector](../API/VectorClass.md) | Obrigatório. The vector to be compared | -| metric | Text | Opcional. [Vector computation](../API/VectorClass.md#understanding-the-different-vector-computations) to use for the query. You can use one of the following (Text) constants:
  • `mk cosine` (default if omitted): calculates the cosine similarity between vectors.
  • `mk dot`: calculates the dot similarity of vectors.
  • `mk euclidean`: calculates the Euclidean distance between vectors. | -| threshold | Real | Optional (default: 0.5). A threshold value used to filter vector comparisons based on their cosine, dot or euclidean similarity score according to the selected "metric". It is highly recommended to choose a similarity that best fits your specific use case for optimal results. | +| Propriedade | Tipo | Descrição | +| ----------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| vector | [4D.Vector](../API/VectorClass.md) | Obrigatório. The vector to be compared | +| metric | Text | Opcional. [Vector computation](../API/VectorClass.md#understanding-the-different-vector-computations) to use for the query. You can use one of the following (Text) constants:
  • `mk cosine` (default if omitted): calculates the [cosine similarity](./VectorClass.md#cosinesimilarity) between vectors.
  • `mk dot`: calculates the [dot similarity](VectorClass.md#dotsimilarity) of vectors.
  • `mk euclidean`: calculates the [Euclidean distance](./VectorClass.md#euclideandistance) between vectors. | +| threshold | Real | Optional (default: 0.5). A threshold value used to filter vector comparisons based on their cosine, dot or euclidean similarity score according to the selected "metric". It is highly recommended to choose a similarity that best fits your specific use case for optimal results. | Only a subset of **comparator** symbols are supported. Note that they compare results to the threshold value: @@ -1237,7 +1237,7 @@ For example, you want to return entities of MyClass where the similarity with a ```4d var $myVector : 4D.Vector $myVector := getVector //method to get a vector, e.g. from 4D.AIKit -var $comparisonVector := {vector: $myVector; metric: mk euclidean; threshold: 1.2} +var $comparisonVector := {vector: $myVector; metric: mk cosine; threshold: 1.2} var $results := ds.MyClass.query("myVectorField <= :1"; $comparisonVector) ``` @@ -1245,20 +1245,24 @@ The **order by** statement is supported in the query string so that entities in ```4d var $results := ds.MyClass.query("myVectorField > :1 order by myVectorField desc"; $comparisonVector) - //the first entity is the most similar + //$results.first() entity is the most similar ``` :::note -The default order is ascending, although a descending order is usually the most useful for vector similarity queries. Thus, you will usually have to add the `desc` keyword in your vector similarity query strings. +You will generally want vector similarity query results to be sorted from "most similar" to "least similar." By default, results returned with an **order by** clause are sorted in ascending order. Depending on the similarity metric used, you may need to adjust the sorting direction to obtain the correct ranking: + +- for [**cosine**](./VectorClass.md#cosinesimilarity) and [**dot**](./VectorClass.md#dotsimilarity) similarity, higher values indicate greater similarity. Therefore, you will typically need to include the `desc` keyword in the query string. +- for [**euclidean distance**](./VectorClass.md#euclideandistance) similarity, lower values indicate greater similarity. In this case, the default ascending order (or explicitly using the `asc` keyword) is appropriate. ::: -If the same vector appears multiple times in the query string, the order by will be applied to the results of the first one, for example: +You can only order on a single vector field. If the same vector appears multiple times in the query string, the order by will be applied to the results of the first one, for example: ```4d var $results := ds.MyClass.query("myVectorField > :1 and myVectorField > :2 order by myVectorField desc"; / - {vector : $myVector1 };{vector : $myVector2 }) //myVectorField > :1 is used for the order by + {vector : $myVector1 };{vector : $myVector2 }) + //myVectorField > :1 is used for the order by ``` See [more examples below](#example-4-2) (examples 4 and 5). @@ -1266,6 +1270,7 @@ See [more examples below](#example-4-2) (examples 4 and 5). :::tip Related blog posts - [4D AI: Searching Entities by Vector Similarity in 4D](https://blog.4d.com/4d-ai-searching-entities-by-vector-similarity-in-4d) +- [4D AI: Sorting Query Results by Vector Similarity](https://blog.4d.com/4d-ai-sorting-query-results-by-vector-similarity/) - [Why Your Search Stack Feels Broken — and How Vector Search Fixes It](https://blog.4d.com/why-your-search-stack-feels-broken-and-how-vector-search-fixes-it) ::: @@ -1633,12 +1638,16 @@ var $result:=$client.embeddings.create("my long text to search"; "text-embedding var $vector:=$result.vector //embedding attribute is based upon a 4D field storing 4D.Vector class objects + //search with default metric (cosine) -var $employees:=ds.Employee.query("embedding > :1"; {vector : $vector}) +var $employees:=ds.Employee.query("embedding > :1 order by embedding desc"; {vector : $vector}) + //search with euclidean metric -var $employees:=ds.Employee.query("embedding > :1"; {vector: $vector; metric: mk euclidean}) +var $employees:=ds.Employee.query("embedding < :1 order by embedding"; {vector: $vector; metric: mk euclidean}) + //search with explicit cosine metric and custom threshold -var $employees:=ds.Employee.query("embedding > :1"; {vector: $vector; metric: mk cosine; threshold: 0.9}) +var $employees:=ds.Employee.query("embedding > :1 order by embedding desc"; {vector: $vector; metric: mk cosine; threshold: 0.9}) + //search with a formula var $employees:=ds.Employee.query(Formula(This.embdedding.cosineSimilarity($vector)>0.9)) @@ -1646,17 +1655,11 @@ var $employees:=ds.Employee.query(Formula(This.embdedding.cosineSimilarity($vect #### Exemplo 2 -We want to execute a query by vector similarity using vectors with different metrics and order the results by cosine similarity: +Vector-based semantic ordering can be combined with traditional ORDA filters in the same query. ```4d - //Create the comparison vectors -var $vector1Comparison:={vector: $myvector; metric: mk cosine; threshold: 0.4} -var $vector2Comparison:={vector: $myvector; metric: mk euclidean; threshold:1} - - //embedding attribute is based upon a 4D field storing 4D.Vector class objects -ds.VectorTable.query("embedding>:1 and embedding<:2";$vector1Comparison;$vector2Comparison)\ - .orderByFormula(Formula(This.embedding.cosineSimilarity($vector1Comparison))) - +var $comparisonVector := {vector: $myVector; metric: mk cosine; threshold: 0.4} +var $results := ds.MyTable.query("myVectorField <= :1 AND salary>100000 order by myVectorField, salary desc"; $comparisonVector) ``` #### Veja também