Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Remove typoTolerance properties at search time
Browse files Browse the repository at this point in the history
  • Loading branch information
gmourier committed Mar 2, 2022
1 parent e2bab40 commit c0ee356
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 65 deletions.
27 changes: 0 additions & 27 deletions open-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -779,26 +779,6 @@ components:
> warn
> Attribute(s) used in `filter` should be declared as filterable attributes. See [Filtering and Faceted Search](https://docs.meilisearch.com/reference/features/filtering_and_faceted_search.html).
typoTolerance.enabled:
name: typoTolerance.enabled
in: query
required: false
typoTolerance.disableOnAttributes:
name: typoTolerance.disableOnAttributes
in: query
required: false
typoTolerance.disableOnWords:
name: typoTolerance.disableOnWords
in: query
required: false
typoTolerance.minWordSizeFor1Typo:
name: typoTolerance.minWordSizeFor1Typo
in: query
required: false
typoTolerance.minWordSizeFor2Typos:
name: typoTolerance.minWordSizeFor2Typos
in: query
required: false
Content-Type:
name: Content-Type
in: header
Expand Down Expand Up @@ -1451,11 +1431,6 @@ paths:
- $ref: '#/components/parameters/sort'
- $ref: '#/components/parameters/limit'
- $ref: '#/components/parameters/matches'
- $ref: '#/components/parameters/typoTolerance.enabled'
- $ref: '#/components/parameters/typoTolerance.disableOnAttributes'
- $ref: '#/components/parameters/typoTolerance.disableOnWords'
- $ref: '#/components/parameters/typoTolerance.minWordSizeFor1Typo'
- $ref: '#/components/parameters/typoTolerance.minWordSizeFor2Typos'
responses:
'200':
description: Ok
Expand Down Expand Up @@ -1566,8 +1541,6 @@ paths:
default: 20
sort:
$ref: '#/components/schemas/sort'
typoTolerance:
$ref: '#/components/schemas/typoTolerance'
examples:
Example:
value:
Expand Down
40 changes: 15 additions & 25 deletions text/0117-typo-tolerance-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

## 1. Summary

This specification describes the configuration options for the typo tolerance feature, both as settings for an index being overridable at search time.
This specification describes the customizable options for the typo tolerance settings.

## 2. Motivation

Expand All @@ -17,20 +17,19 @@ Meilisearch can adapt to different use-cases with specific requirements by provi

### 3.1. `typoTolerance` API resource definition

| Field | Type | Required |
|----------------------|-----------------|----------------------------------|
| enabled | Boolean | True (Settings) - False (Search) |
| disableOnAttributes | Array of String | True (Settings) - False (Search) |
| disableOnWords | Array of String | True (Settings) - False (Search) |
| minWordSizeFor1Typo | Integer | True (Settings) - False (Search) |
| minWordSizeFor2Typos | Integer | True (Settings) - False (Search) |
| Field | Type | Required |
|----------------------|-----------------|----------|
| enabled | Boolean | True |
| disableOnAttributes | Array of String | True |
| disableOnWords | Array of String | True |
| minWordSizeFor1Typo | Integer | True |
| minWordSizeFor2Typos | Integer | True |

> Every field of typoTolerance object is mandatory when specified as an index setting. When a property of this setting is overridden during the search time, other resource properties are not required.

#### 3.1.1. `enabled`

- Type: Boolean
- Required: True (Settings) - False (Search)
- Required: True
- Default: `true`

Whether the typo tolerance feature is enabled.
Expand All @@ -42,7 +41,7 @@ If the `rankingRules` parameter of the index settings does not contain the `typo
### 3.1.2. `disableOnAttributes`

- Type: Array of String
- Required: True (Settings) - False (Search)
- Required: True
- Default: `[]`

`disableOnAttributes` disable the typo tolerance feature on the specified attributes set.
Expand All @@ -53,7 +52,7 @@ If the `rankingRules` parameter of the index settings does not contain the `typo
### 3.1.3. `disableOnWords`

- Type: Array of String
- Required: True (Settings) - False (Search)
- Required: True
- Default: `[]`

`disableOnWords` disable the typo tolerance feature for a set of search query terms.
Expand All @@ -63,7 +62,7 @@ If the `rankingRules` parameter of the index settings does not contain the `typo
### 3.1.4. `minWordSizeFor1Typo`

- Type: Integer
- Required: True (Settings) - False (Search)
- Required: True
- Default: `5`

`minWordSizeFor1Typo` customize the minimum size for a word to tolerate 1 typo.
Expand All @@ -73,7 +72,7 @@ If the `rankingRules` parameter of the index settings does not contain the `typo
### 3.1.5. `minWordSizeFor2Typos`

- Type: Integer
- Required: True (Settings) - False (Search)
- Required: True
- Default: `9`

`minWordSizeFor2Typos` customize the minimum size for a word to tolerate 2 typos.
Expand All @@ -86,8 +85,6 @@ If the `rankingRules` parameter of the index settings does not contain the `typo

Manage the typo tolerance configuration for an index.

> This configuration can be overridden at search time. See 3.4.1 `indexes/:index_uid/search` section.
#### 3.2.1.1 `GET` - `indexes/:index_uid/settings/typo-tolerance`

Allow fetching the current definition of the typo tolerance feature for an index.
Expand Down Expand Up @@ -158,7 +155,7 @@ Request payload

#### 3.2.1.3 `DELETE`- `indexes/:index_uid/settings/typo-tolerance`

Allow resetting the default settings of the typo tolerance feature for an index.
Allow resetting the typo tolerance feature to the default for an index.

> Returns a 202 response. See [Tasks API](0060-tasks-api.md)
Expand All @@ -172,17 +169,10 @@ Allow resetting the default settings of the typo tolerance feature for an index.

> See [Settings API]
### 3.4.1 `indexes/:index_uid/search`

The typo tolerance resource is exposed on the search endpoints. It lets users build a search experience fastly by testing different configurations while editing the frontend. Thus, defining specific typo tolerance settings at search can be helpful when diverse audiences search in the same index from different clients.

If defined for a search query, a `typoTolerance` property overrides its value defined in the `typoTolerance` index settings.

> See [Search API](0118-search-api.md)
## 2. Technical Details
tbd

## 3. Future Possibilities
- Expose `typoTolerance` properties at search time.
- Add the possibility to disable typo-tolerance on all numeric fields.
- Add different modes of result matching for the typo-tolerance feature. e.g. `default`/`min`/`strict`
13 changes: 0 additions & 13 deletions text/0118-search-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ If the instance is secured by a master-key, the auth layer returns the following
| attributesToCrop | Array of String - String | False |
| cropLength | Integer | False |
| matches | Boolean | False |
| typoTolerance | Object[typoTolerance] | False |

##### 1.2.1.1 `q`

Expand Down Expand Up @@ -208,18 +207,6 @@ Adds a `_matchesInfo` object to the search response that contains the location o

- 🔴 Sending a value with a different type than `Boolean` or `null` for `matches` returns a [bad_request](0061-error-format-and-definitions.md#bad_request) error.

##### 1.2.1.12 `typoTolerance`

- Type: Object[typoTolerance]
- Required: False
- Default: `null`

Override typo tolerance settings at search time.

The attributes of the `typoTolerance` object are not mandatory at search time.

> See [Typo Tolerance](0117-typo-tolerance-api.md)
#### 1.2.2. Search response

| Field | Type | Required |
Expand Down

0 comments on commit c0ee356

Please sign in to comment.