-
Notifications
You must be signed in to change notification settings - Fork 11
Improve formatted spec #146
Improve formatted spec #146
Conversation
|
||
If `"*"` is provided as a value: `attributesToHighlight=["*"]` all the attributes present in `displayedAttributes` setting will be automatically assigned to `_formatted`. | ||
If `"*"` is provided as a value (`attributesToHighlight=["*"]`), all the attributes present in `displayedAttributes` setting will be highlighted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed every mentions/explanations regarding the _formatted
behavior from this part, except to redirect to the dedicated section, to avoid any confusion
If `attributesToCrop` is present in the search query, the search results will include a `_formatted` object containing the attributes and their cropped parts. For more detailed regarding the `_formatted` behavior, see the [3.2.1.1.2. `_formatted`](#32112-formatted) section. | ||
|
||
If `"*"` is provided as a value (`attributesToCrop=["*"]`), all the attributes present in `displayedAttributes` setting will be cropped. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed the same "format" as for attributesToHighlight
. First, talking and redirect to the formatted section, then the *
value behavior, and finally the available parameters.
- If a list of fields is defined for `attributesToRetrieve` and `attributesToHighlight` / `attributesToCrop` are equals to `*`, `_formatted` is returned and contains `displayedAttributes` setting fields then compute highlights and crops on each received fields. | ||
- If a list of fields is defined for `attributesToRetrieve` and `attributesToHighlight` / `attributesToCrop` contains a list of fields, `_formatted` is returned and contains `attributesToRetrieve` fields, plus the fields set in `attributesToHighlight` or `attributesToCrop` then compute highlights and crops only for fields defined in `attributesToHighlight` / `attributesToCrop` parameters. | ||
|
||
Some examples: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The examples are here to help, but do NOT replace the explanation: there are just here to illustrate the sentences above.
The sentences above should replace each point you wrote in the previous list (that I erased). Ensure this is the case 😇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO It's much clearer that way, I think it's inevitable to have examples even if I'd like to avoid them to make the specifications lighter. Thank you for this!
text/0118-search-api.md
Outdated
|
||
The `_formatted` object will contain attributes coming from the original document, depending on the parameters the users set during the search query. Indeed, **the attributes present in `_formatted` is the addition of the attributes present in `attributesToRetrieve`, `attributesToHighlight`, and `attributesToCrop`**. | ||
|
||
Kmowing the default value of `attributesToRetrieve` is `["*"]` (so all the attributes present in `displayedAttributes`), if no `attributesToRetrieve` are set in the search query, `_formatted` will return all the `displayedAttributes`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But that’s not the case 🤔
If you don’t send any attributesToRetrieve
then your _formatted
field should be empty no?
{ "q": "hello" }
Should not return any _formatted
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a clarification about the _formatted
behavior when not sending attributesToRetrieve
but sending attributesToHighlight
or attributesToCrop
(the previous sentence explains that _formatted
will be present only if attributesToHighlight
or attributesToCrop
are specified).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will try to clarify this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did an update, tell me if it's better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🐸 Thanks @curquiza!
Co-authored-by: Tamo <irevoire@protonmail.ch>
Co-authored-by: Tamo <irevoire@protonmail.ch>
Co-authored-by: Tamo <irevoire@protonmail.ch>
Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com>
Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🔥
* Improve formatted spec * Update text/0118-search-api.md Co-authored-by: Tamo <irevoire@protonmail.ch> * Update text/0118-search-api.md Co-authored-by: Tamo <irevoire@protonmail.ch> * Update text/0118-search-api.md Co-authored-by: Tamo <irevoire@protonmail.ch> * Update text/0118-search-api.md Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Update text/0118-search-api.md Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Improve according to reviews Co-authored-by: Tamo <irevoire@protonmail.ch> Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com>
* Draft a revamp of the formatting search results spec * Removes formatting-search-results specification * wip * Fix links * Add precision * Update OpenAPI * Fix sentences * Add consistency * Add details and fix sentences * Fix default value in OpenAPI spec * Add Future Possibilities for _matchesInfo * Remove bullet point title * Add wip examples * Add _formatted behavior regarding attributesToRetrieve, attributesToCrop and attributesToHighlight * Apply suggestions from code review Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Fix typo * Mention no effect case of cropMarker / cropLength / highlightPostTag / highlightPreTag on attributesToCrop & attributesToHighlight * Re-explain _formatted in details * Mention Synonyms * Add precision after team feedback * Apply suggestions from code review Co-authored-by: gui machiavelli <hey@guimachiavelli.com> * Add precisions * Add boolean analytics for fields dedicated to customize formatting of search results behaviors * Precise behavior for _formatted * Add clearer explanations for the cropping algorithm and the fact that it keep the phrase context when extending around * Apply suggestions from code review Co-authored-by: Many <legendre.maxime.isn@gmail.com> Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> Co-authored-by: Tommy <68053732+dichotommy@users.noreply.github.com> * Precise highlighting around every matched query term * Apply suggestions from code review Co-authored-by: gui machiavelli <hey@guimachiavelli.com> Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Precise cropLength behavior when 0 is specified * Remove filter-and-facet-behavior spec to merge it into search-api, and correct some types description * Improve formatted spec (#146) * Improve formatted spec * Update text/0118-search-api.md Co-authored-by: Tamo <irevoire@protonmail.ch> * Update text/0118-search-api.md Co-authored-by: Tamo <irevoire@protonmail.ch> * Update text/0118-search-api.md Co-authored-by: Tamo <irevoire@protonmail.ch> * Update text/0118-search-api.md Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Update text/0118-search-api.md Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Improve according to reviews Co-authored-by: Tamo <irevoire@protonmail.ch> Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Add missing precision for highlightPostTag * fix broken links Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> Co-authored-by: gui machiavelli <hey@guimachiavelli.com> Co-authored-by: Many <legendre.maxime.isn@gmail.com> Co-authored-by: Tommy <68053732+dichotommy@users.noreply.github.com> Co-authored-by: Clémentine Urquizar - curqui <clementine@meilisearch.com> Co-authored-by: Tamo <irevoire@protonmail.ch>
* Draft a revamp of the formatting search results spec * Removes formatting-search-results specification * wip * Fix links * Add precision * Update OpenAPI * Fix sentences * Add consistency * Add details and fix sentences * Fix default value in OpenAPI spec * Add Future Possibilities for _matchesInfo * Remove bullet point title * Add wip examples * Add _formatted behavior regarding attributesToRetrieve, attributesToCrop and attributesToHighlight * Apply suggestions from code review Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Fix typo * Mention no effect case of cropMarker / cropLength / highlightPostTag / highlightPreTag on attributesToCrop & attributesToHighlight * Re-explain _formatted in details * Mention Synonyms * Add precision after team feedback * Apply suggestions from code review Co-authored-by: gui machiavelli <hey@guimachiavelli.com> * Add precisions * Add boolean analytics for fields dedicated to customize formatting of search results behaviors * Precise behavior for _formatted * Add clearer explanations for the cropping algorithm and the fact that it keep the phrase context when extending around * Apply suggestions from code review Co-authored-by: Many <legendre.maxime.isn@gmail.com> Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> Co-authored-by: Tommy <68053732+dichotommy@users.noreply.github.com> * Precise highlighting around every matched query term * Apply suggestions from code review Co-authored-by: gui machiavelli <hey@guimachiavelli.com> Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Precise cropLength behavior when 0 is specified * Remove filter-and-facet-behavior spec to merge it into search-api, and correct some types description * Improve formatted spec (#146) * Improve formatted spec * Update text/0118-search-api.md Co-authored-by: Tamo <irevoire@protonmail.ch> * Update text/0118-search-api.md Co-authored-by: Tamo <irevoire@protonmail.ch> * Update text/0118-search-api.md Co-authored-by: Tamo <irevoire@protonmail.ch> * Update text/0118-search-api.md Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Update text/0118-search-api.md Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Improve according to reviews Co-authored-by: Tamo <irevoire@protonmail.ch> Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Add missing precision for highlightPostTag * fix broken links Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> Co-authored-by: gui machiavelli <hey@guimachiavelli.com> Co-authored-by: Many <legendre.maxime.isn@gmail.com> Co-authored-by: Tommy <68053732+dichotommy@users.noreply.github.com> Co-authored-by: Clémentine Urquizar - curqui <clementine@meilisearch.com> Co-authored-by: Tamo <irevoire@protonmail.ch>
* Instance Options (#119) * Add instance options spec * Update text/0119-instance-options.md Co-authored-by: Guillaume Mourier <guillaume@meilisearch.com> * Update text/0119-instance-options.md Co-authored-by: Guillaume Mourier <guillaume@meilisearch.com> * Update text/0119-instance-options.md Co-authored-by: Guillaume Mourier <guillaume@meilisearch.com> * Update text/0119-instance-options.md Co-authored-by: Guillaume Mourier <guillaume@meilisearch.com> * Update text/0119-instance-options.md Co-authored-by: Guillaume Mourier <guillaume@meilisearch.com> * Update text/0119-instance-options.md Co-authored-by: Guillaume Mourier <guillaume@meilisearch.com> * Update text/0119-instance-options.md Co-authored-by: Guillaume Mourier <guillaume@meilisearch.com> * Update text/0119-instance-options.md Co-authored-by: Guillaume Mourier <guillaume@meilisearch.com> * Update text/0119-instance-options.md Co-authored-by: Guillaume Mourier <guillaume@meilisearch.com> * Numeric title + add dump options * Add link to dump spec * Update text/0119-instance-options.md Co-authored-by: Guillaume Mourier <guillaume@meilisearch.com> * Update text/0119-instance-options.md Co-authored-by: Guillaume Mourier <guillaume@meilisearch.com> * Add title numerotations * Add telemetry for new options * Apply changes after the review * Update text/0119-instance-options.md * Update text/0119-instance-options.md Co-authored-by: Many <legendre.maxime.isn@gmail.com> * Update text/0119-instance-options.md Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Update text/0119-instance-options.md Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Change naming after the review * Update text/0034-telemetry-policies.md * Update text/0034-telemetry-policies.md * Update text/0034-telemetry-policies.md * Update text/0034-telemetry-policies.md * Apply suggestions from code review Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Update text/0119-instance-options.md Co-authored-by: Clémentine Urquizar - curqui <clementine@meilisearch.com> * Update text/0119-instance-options.md Co-authored-by: Clémentine Urquizar - curqui <clementine@meilisearch.com> Co-authored-by: Guillaume Mourier <guillaume@meilisearch.com> Co-authored-by: Many <legendre.maxime.isn@gmail.com> Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Settings API - v0.26.0 state (#123) * Add a Settings API specification file * Add distinct-attribute-setting-api.md * Add displayed-attributes and searchable-attributes specification file * Add stop-words setting api * Add synonyms setting api * Rename spec files and fix some typos * Add ranking rules setting api * Add filterable-attributes and sortable-attributes settings API * Add a Triggering Documents Re-Indexing technical section * Rephrase 202 Accepted Response for POST Methods * Apply Triggering Documents Re-Indexing Technical part on related sub settings * Update synonyms setting api file * Precise and rephrase some sentences * Remove bullet point title * Add limitation about manually specifying searchableAttributes * Update spec template according to our current usage (#127) * Update spec template according to our current usage * Update text/0000-specification-template.md Co-authored-by: Guillaume Mourier <guillaume@meilisearch.com> * Remove bullet point dedicated to title * Rename Technical Aspects to Technical Details Co-authored-by: Guillaume Mourier <guillaume@meilisearch.com> * Documents API (#133) * Catch-up documents api specification * Add precisions and examples * Apply suggestions from code review Co-authored-by: Many <legendre.maxime.isn@gmail.com> Co-authored-by: Many <legendre.maxime.isn@gmail.com> * Stats API (#134) * Add Stats API specification * Rename spec file with pr number * Clean typo, add precisions and fix inner linking * Apply suggestions from code review Co-authored-by: maryamsulemani97 <90181761+maryamsulemani97@users.noreply.github.com> * Change order of API endpoints Co-authored-by: maryamsulemani97 <90181761+maryamsulemani97@users.noreply.github.com> * Errors - Add variant for `invalid_filter`/`invalid_sort` when related settings are empty (#125) * Add variant for invalid_sort and invalid_filter errors when settings are empty * Update text/0061-error-format-and-definitions.md Co-authored-by: gui machiavelli <hey@guimachiavelli.com> Co-authored-by: gui machiavelli <hey@guimachiavelli.com> * Add missing "v" in the user-agent data (#136) Following the issue meilisearch/integration-guides#150 there is a "v" before the version of the package. * Indexes API (#132) * Catch-up Indexes API * Add details by field for an Index API Resource * fix typo * Add future possibilities * Apply suggestions from code review Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Add precisions from review * lowercase type Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Remove never-implemented and deprecated 0042-paginated-search.md (#147) * Settings API - Typo Tolerance (#117) * Draft file for Typo Tolerance specification * rename spec file * Rename specification * draft * Add open-api.yaml prototype * Add typoTolerance component on POST search * Add typoTolerance object into search api parameters * fix typos * remove the past tense * Add typoTolerance GET query parameters * Fix description * Add explanations for disableOnWords property * Update spec href * Describe indexes/:index_uid/settings/typo-tolerance endpoint * Explain why it is useful to expose typo tolerance settings at search time * Remove typoTolerance properties at search time * Add a future possiblity to change POST verb to PATCH to edit a settings partially * Sync spec with telemetry * Mark TODO on technical details and rework structure of specification * Specify properties required to false to allow partial updates * Add error definitions for typoTolerance API resource properties * Rename spec file * Restore deleted metric * Update text/0117-typo-tolerance-settings-api.md Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Update text/0117-typo-tolerance-settings-api.md Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Bruno Casali <brunoocasali@gmail.com> * Replace W to w in telemtry * Apply consistency on new errors message * fix typo * Add Async Errors and Lazy Index Creation * Rename telemetry nodes * Mention case insensivity of disableOnWords parameter * Describes synchronous (type-checking) and asynchronous (business logic) errors * Add examples for minWordSizeFor1Typo and minWordSizeFor2Typos * Elaborate on examples * Remove title bullet point * Apply naming suggestions * Apply naming changes on telemetry and miss on OpenAPI * Branch typo sub-ressource to settings-api specification * Fix typo (lul) * Add Technical Details * Apply suggestions from code review Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Replace minWordSizeForXTypos fields by a minWordSizeForTypos object * Update text/0034-telemetry-policies.md Co-authored-by: ad hoc <postma.marin@protonmail.com> * Apply suggestions from code review Co-authored-by: Tommy <68053732+dichotommy@users.noreply.github.com> * Remove dedicated error for type checking * Update text/0034-telemetry-policies.md Co-authored-by: Bruno Casali <brunoocasali@gmail.com> * Bring naming changes * Fix metrics name for typo_tolerance * Update text/0034-telemetry-policies.md Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> Co-authored-by: Bruno Casali <brunoocasali@gmail.com> Co-authored-by: ad hoc <postma.marin@protonmail.com> Co-authored-by: Tommy <68053732+dichotommy@users.noreply.github.com> * Data Types - Add Nested Fields Support (#121) * Add a draft spec with nested fields flattening examples * Consitent phrasing * Fix markdown syntax * Add null section * Add Object example section * Apply suggestions from code review Co-authored-by: Clément Renault <renault.cle@gmail.com> * Rename spec file to PR id * Add special searchableAttributes default case with flattening alg * Rephrase document structure representation * Add a dotnotation section * Add dot-notation section * Update text/0121-data-types.md Co-authored-by: Quentin de Quelen <quentin@meilisearch.com> * Add Future Possibilities * Rework nested notation sections * Fix TODO and mention the . notation and all properties notation * Add a edge case section * Fix missing block code marker * Update text/0123-ranking-rules-setting-api.md Co-authored-by: Clément Renault <renault.cle@gmail.com> * Apply suggestions from code review Co-authored-by: Tommy <68053732+dichotommy@users.noreply.github.com> Co-authored-by: Clément Renault <renault.cle@gmail.com> * Fix section number * Remove unclear sentence * Remove dedicated object section Co-authored-by: Clément Renault <renault.cle@gmail.com> Co-authored-by: Quentin de Quelen <quentin@meilisearch.com> Co-authored-by: Tommy <68053732+dichotommy@users.noreply.github.com> * Search API - Formatting Search Results (#120) * Draft a revamp of the formatting search results spec * Removes formatting-search-results specification * wip * Fix links * Add precision * Update OpenAPI * Fix sentences * Add consistency * Add details and fix sentences * Fix default value in OpenAPI spec * Add Future Possibilities for _matchesInfo * Remove bullet point title * Add wip examples * Add _formatted behavior regarding attributesToRetrieve, attributesToCrop and attributesToHighlight * Apply suggestions from code review Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Fix typo * Mention no effect case of cropMarker / cropLength / highlightPostTag / highlightPreTag on attributesToCrop & attributesToHighlight * Re-explain _formatted in details * Mention Synonyms * Add precision after team feedback * Apply suggestions from code review Co-authored-by: gui machiavelli <hey@guimachiavelli.com> * Add precisions * Add boolean analytics for fields dedicated to customize formatting of search results behaviors * Precise behavior for _formatted * Add clearer explanations for the cropping algorithm and the fact that it keep the phrase context when extending around * Apply suggestions from code review Co-authored-by: Many <legendre.maxime.isn@gmail.com> Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> Co-authored-by: Tommy <68053732+dichotommy@users.noreply.github.com> * Precise highlighting around every matched query term * Apply suggestions from code review Co-authored-by: gui machiavelli <hey@guimachiavelli.com> Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Precise cropLength behavior when 0 is specified * Remove filter-and-facet-behavior spec to merge it into search-api, and correct some types description * Improve formatted spec (#146) * Improve formatted spec * Update text/0118-search-api.md Co-authored-by: Tamo <irevoire@protonmail.ch> * Update text/0118-search-api.md Co-authored-by: Tamo <irevoire@protonmail.ch> * Update text/0118-search-api.md Co-authored-by: Tamo <irevoire@protonmail.ch> * Update text/0118-search-api.md Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Update text/0118-search-api.md Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Improve according to reviews Co-authored-by: Tamo <irevoire@protonmail.ch> Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> * Add missing precision for highlightPostTag * fix broken links Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> Co-authored-by: gui machiavelli <hey@guimachiavelli.com> Co-authored-by: Many <legendre.maxime.isn@gmail.com> Co-authored-by: Tommy <68053732+dichotommy@users.noreply.github.com> Co-authored-by: Clémentine Urquizar - curqui <clementine@meilisearch.com> Co-authored-by: Tamo <irevoire@protonmail.ch> * Bump API to v0.27.0 version Co-authored-by: Clémentine Urquizar - curqui <clementine@meilisearch.com> Co-authored-by: Many <legendre.maxime.isn@gmail.com> Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com> Co-authored-by: maryamsulemani97 <90181761+maryamsulemani97@users.noreply.github.com> Co-authored-by: gui machiavelli <hey@guimachiavelli.com> Co-authored-by: Bruno Casali <brunoocasali@gmail.com> Co-authored-by: ad hoc <postma.marin@protonmail.com> Co-authored-by: Tommy <68053732+dichotommy@users.noreply.github.com> Co-authored-by: Clément Renault <renault.cle@gmail.com> Co-authored-by: Quentin de Quelen <quentin@meilisearch.com> Co-authored-by: Tamo <irevoire@protonmail.ch>
Following our discusssion @gmourier, @irevoire, @bidoubiwa, I tried to make the
_formatted
behavior clearer.Is it the case for you?