From b90929a736089288e216a39a3b9915fb18c02aea Mon Sep 17 00:00:00 2001 From: gui machiavelli Date: Thu, 18 Jul 2024 17:09:16 +0200 Subject: [PATCH] Remove meilisearch 101 files (#2909) --- .../meilisearch_101/customizing_relevancy.mdx | 186 ---------------- .../meilisearch_101/filtering_and_sorting.mdx | 198 ------------------ .../getting_ready_for_production.mdx | 46 ---- 3 files changed, 430 deletions(-) delete mode 100644 learn/meilisearch_101/customizing_relevancy.mdx delete mode 100644 learn/meilisearch_101/filtering_and_sorting.mdx delete mode 100644 learn/meilisearch_101/getting_ready_for_production.mdx diff --git a/learn/meilisearch_101/customizing_relevancy.mdx b/learn/meilisearch_101/customizing_relevancy.mdx deleted file mode 100644 index f4d746e453..0000000000 --- a/learn/meilisearch_101/customizing_relevancy.mdx +++ /dev/null @@ -1,186 +0,0 @@ ---- -title: Fine-tuning search results — Meilisearch documentation -description: This second article of the Meilisearch 101 series teaches you how to customize search relevancy with index settings. ---- - -# Fine-tuning search results - -Meilisearch is designed to offer a great search experience out of the box, but sometimes you need to customize it to better fit your needs. You can alter the search behavior for each index using the `settings` object. - -For this chapter, we will be using a collection of movies as our dataset. - -To follow along, first click this link to download the file: movies.json. Then, move it into your working directory and run the following command: - - - -## Ranking rules - -Meilisearch sorts search responses based on an array of rules called `rankingRules`, which is part of the `settings` object. - -The order of the `rankingRules` array matters: the first rule has the most impact and the last rule has the least. This is the default order: - -``` -"rankingRules": [ - "words", - "typo", - "proximity", - "attribute", - "sort", - "exactness" -] -``` - -You can read more about each ranking rule and what it does in our [dedicated guide](/learn/relevancy/ranking_rules). - -In this example, we change the order of the ranking rules for the `movies` index by moving `exactness` to the top: - - - -You can read more about ranking rules in our [dedicated guide](/learn/relevancy/relevancy). - -## Displayed attributes - -By default, all attributes are displayed in search results but the `displayedAttributes` array in the `settings` object allows you to change that. - -If you only want to display the `title`, `poster`, and `overview` for the `movies` index: - - - -You can read more about displayed attributes in our [dedicated guide](/learn/relevancy/displayed_searchable_attributes#displayed-fields). - -## Distinct attribute - -If you have groups of almost identical documents, you may wish to only return one of them per search. `distinctAttribute` is a tool in the `settings` object that allows you to do just that. - -When you set one of your attributes as the `distinctAttribute`, Meilisearch will not return more than one document with the same value associated to that attribute. - -Suppose you have an e-commerce dataset with an index on jackets. There are several identical items with minor variations in color. - -```json -[ - { - "id": 1, - "description": "Leather jacket", - "brand": "Lee jeans", - "color": "brown", - "product_id": "123456" - }, - { - "id": 2, - "description": "Leather jacket", - "brand": "Lee jeans", - "color": "black", - "product_id": "123456" - }, - { - "id": 3, - "description": "Leather jacket", - "brand": "Lee jeans", - "color": "blue", - "product_id": "123456" - } -] -``` - -If you searched for `lee leather jacket` with the default settings, you would get all three documents. But if you set `product_id` as the `distinctAttribute`, Meilisearch will only return one of those jackets. - -You can read more about the distinct attribute in our [dedicated guide](/learn/relevancy/distinct_attribute). - -## Searchable attributes - -[Documents](/learn/core_concepts/documents) in Meilisearch are composed of multiple fields. By default, Meilisearch looks for matches in every field, but the `searchableAttributes` array in the `settings` object allows you to change that. - -For example, if you search the `movies` index for `2012`, Meilisearch searches for `2012` in every field: the `title`, `overview`, `release_year`, and so on. If you just want to search in the `title` field: - - - -Meilisearch will now only consider `title` during search, and you will see fewer results. - - - -Meilisearch will still highlight matches in other fields, but they won’t be used to compute results. - - - -### The order of `searchableAttributes` - -The order of the `searchableAttributes` array corresponds to the order of importance of the attributes. - -```json - [ - "overview", - "title", - ] -``` - -With the above order, matching words found in the `overview` field will have a higher impact on relevancy than the same words found in `title`. You can read more about this in our [relevancy guide](/learn/relevancy/attribute_ranking_order). - -## Stop words - -Meilisearch allows you to ignore certain words in your search queries by adding them to the `stopWords` array. A good example is the word `the` in English. - - - -If you search for `the cat` after running the above command, Meilisearch will consider your search query to be `cat`, improving the speed and relevancy of your search. - -You can read more about stop words in the [API reference](/reference/api/settings#stop-words). - -## Synonyms - -The `synonyms` array lets you associate certain words in your dataset, telling Meilisearch that they are equivalent and interchangeable. - - - -This will set `winnie` and `piglet` as synonyms. Searching for either won't always return the same results due to factors like typos and splitting the query. - -You can read more about it in our [dedicated guide](/learn/relevancy/synonyms). - -## Typo tolerance - -Meilisearch is typo tolerant by default. It will help you find relevant search results even if you make spelling mistakes or typos, for example, searching for `swaj` instead of `swan`. - -The `typoTolerance` object allows you to: - -- Enable or disable the typo tolerance feature -- Configure the minimum word size for typos -- Disable typos on specific words -- Disable typos on specific attributes - -Meilisearch accepts one typo for query terms containing `5` or more characters by default. If you search the movies index for `swaj`, you will not get any results. - - - -The above code sample sets the minimum word size for one typo to `4` characters. If you search for `swaj` now, you should get some results. - -You can read more about typo tolerance in our [dedicated guide](/learn/relevancy/typo_tolerance_settings). - -## Faceting - -Meilisearch allows you to create faceted search interfaces, refining search results based on broad categories called facets. Like filters, you need to add the attributes you want to use as facets to `filterableAttributes`. - -When creating a faceted search interface, it is helpful to display how results are distributed between the different categories. For example, a user might want to know how many of their results have a `genre` of `comedy` and how many have a `genre` of `horror`. Meilisearch supports this with [the `facets` search parameter](/reference/api/search#facets). - -Using the faceting settings, you can: - -- Configure the maximum number of facet values returned for each facet -- Sort facet values by value count or alphanumeric order - -Suppose your results contain the following values for the `genres` facet: `Action`, `Adventure`, `Science Fiction`, and `Comedy`. After running the below code sample, you would only see how results are distributed between the `Action` and `Adventure` genres. `Action` and `Adventure` will be sorted by descending value count. - - - -You can read more about faceting in our [dedicated guide](/learn/filtering_and_sorting/search_with_facet_filters). - -## Pagination - -By default, Meilisearch returns 1000 results per search. This limit protects your database from malicious scraping. - -The code sample below sets this limit to 500: - - - -Now, users won't be able to access search results beyond 500. - -You can read more about pagination in our [dedicated guide](/guides/front_end/pagination). - -The next chapter tackles more advanced topics, including security and data backup. diff --git a/learn/meilisearch_101/filtering_and_sorting.mdx b/learn/meilisearch_101/filtering_and_sorting.mdx deleted file mode 100644 index 1081b95ba0..0000000000 --- a/learn/meilisearch_101/filtering_and_sorting.mdx +++ /dev/null @@ -1,198 +0,0 @@ ---- -title: Filtering and sorting — Meilisearch documentation -description: The Meilisearch 101 is a series of guides introducing core Meilisearch features. This first article teaches you how to refine search results with filtering and sorting. ---- - -# Filtering and sorting - -Welcome to the Meilisearch 101! This guide aims to introduce you to the main features of Meilisearch as efficiently as possible. It assumes that you have completed the [Quick start](/learn/getting_started/quick_start) and already have a running Meilisearch instance. - -This chapter uses a dataset of meteorites to demonstrate filtering, sorting, and geosearch. To follow along, first click this link to download the file: meteorites.json. Then, move it into your working directory and run the following command: - - - -Each meteorite in our dataset contains information on things such as their mass and their geographic coordinates. In Meilisearch, we refer to these bits of data associated with a document as 'fields'. Every field has a name, which we call an 'attribute' and a value. - -## Settings - -Every index contains a `settings` object that allows you to customize search behavior. Configuring this object is the first step to filtering and sorting your data. - -The `settings` object contains two arrays for this purpose: `filterableAttributes` and `sortableAttributes`. - - - -The above code sample adds `mass` and `_geo` to `filterableAttributes` and `sortableAttributes` setting you up for the next sections. - -To learn more about the `settings` object and how to configure it, check out the [API reference](/reference/api/settings). - -## Filtering - -Meilisearch allows you to refine your search using filters. You can use any document fields for filtering by adding them to `filterableAttributes` as shown [above](#settings). - -Let's say you only want to view meteorites that weigh less than 200g: - - - -```json -{ - "hits":[ - { - "name": "Aachen", - "mass": 21 - }, - { - "name": "Emmaville", - "mass": 127 - }, - … - ], - "estimatedTotalHits": 114, - "query": "", - "limit": 20, - "offset": 0, - "processingTimeMs": 0 -} -``` - -Filtering is intended to be combined with search queries to refine your results. - -To learn more about filters and how to configure them, refer to our [dedicated guide](/learn/filtering_and_sorting/filter_search_results). - -## Sorting - -By default, Meilisearch orders results according to their relevancy. You can alter this sorting behavior as part of the search request, allowing users to decide which type of results they want to see first. - -You can use any document field for sorting as long as it contains numbers, strings, arrays of numbers, or arrays of strings and has been added to `sortableAttributes` as shown [above](#settings). - -Let's sort the meteorites in the previous example based on mass: - - - -```json -{ - "hits":[ - { - "name": "Silistra", - "mass": 0.15 - }, - { - "name": "Hachi-oji", - "mass": 0.2 - }, - … - ], - "estimatedTotalHits": 114, - "query": "", - "limit": 20, - "offset": 0, - "processingTimeMs": 1 -} -``` - -You will see all meteorites weighing less than 200g sorted by increasing mass. To sort them in the opposite direction, you would use `mass:desc`. - -Sorting is intended to be combined with search queries to refine your results. - -To learn more about sorting and how to configure it, refer to our [dedicated guide](/learn/filtering_and_sorting/sort_search_results). - -## Geosearch - -Meilisearch allows you to filter and sort results based on their geographic location. To use this feature, your documents need to have the `_geo` field, which must be added to `sortableAttributes` or `filterableAttributes` depending on your use case. - -### Filtering by geographical location - -Let's say you want to find out which meteorites crashed within a 210km radius of Bern: - - - -```json -{ - "hits":[ - { - "name": "Ensisheim", - "id": "10039", - "nametype": "Valid", - "recclass": "LL6", - "mass": "127000", - "fall": "Fell", - "year": "1492-01-01T00:00:00.000", - "_geo": { - "lat": 47.86667, - "lng": 7.35 - } - }, - { - "name": "Épinal", - "id": "10041", - "nametype": "Valid", - "recclass": "H5", - "mass": "277", - "fall": "Fell", - "year": "1822-01-01T00:00:00.000", - "_geo": { - "lat": 48.18333, - "lng": 6.46667 - } - }, - … - ], - "estimatedTotalHits": 7, - "query": "", - "limit": 20, - "offset": 0, - "processingTimeMs": 3 - } - ``` - -### Sorting by geographical location - -The following command sorts meteorites by how close they were to the Taj Mahal: - - - -```json -{ - "hits":[ - { - "name": "Nagaria", - "id": "16892", - "nametype": "Valid", - "recclass": "Eucrite-cm", - "mass": "20", - "fall": "Fell", - "year": "1875-01-01T00:00:00.000", - "_geo": { - "lat": 26.98333, - "lng": 78.21667 - }, - "_geoDistance": 27449 - }, - { - "name": "Kheragur", - "id": "12294", - "nametype": "Valid", - "recclass": "L6", - "mass": "450", - "fall": "Fell", - "year": "1860-01-01T00:00:00.000", - "_geo": { - "lat": 26.95, - "lng": 77.88333 - }, - "_geoDistance": 29558 - }, - … - ] - "estimatedTotalHits": 1000, - "query": "", - "limit": 20, - "offset": 0, - "processingTimeMs": 4 - } -``` - -This response returns an additional field, `_geoDistance`, representing the distance between the Taj Mahal and each meteorite in meters. - -To learn more about geosearch and how to configure it, refer to our [dedicated guide](/learn/filtering_and_sorting/geosearch). - -The next chapter dives deeper into the `settings` object and how you can use it to fine-tune results. diff --git a/learn/meilisearch_101/getting_ready_for_production.mdx b/learn/meilisearch_101/getting_ready_for_production.mdx deleted file mode 100644 index b0784463f7..0000000000 --- a/learn/meilisearch_101/getting_ready_for_production.mdx +++ /dev/null @@ -1,46 +0,0 @@ ---- -title: Getting ready for production — Meilisearch documentation -description: Learn about instance options, data backup, and multitenancy in this final article of the Meilisearch 101 series. ---- - -# Getting ready for production - -This chapter will help you get ready to use Meilisearch in production by covering topics such as instance-wide options, data backup, and multitenancy. - -## Instance options - -Meilisearch allows you to configure your entire instance through **[environment variables](/learn/configuration/instance_options#environment-variables)** before launch or **[command-line options](/learn/configuration/instance_options#command-line-options-and-flags)** at launch. - -Meilisearch has configuration options for many critical actions, such as: - -- Changing the database path -- Starting Meilisearch in a development or production environment -- Setting a master key to protect API endpoints - -You can read about all of them in our [configuration guide](/learn/configuration/instance_options). - -## Data backup - -Meilisearch offers two options for backing up your data: `dumps` and `snapshots`. - -Dumps export data in a raw unprocessed form and can be used to migrate your database between Meilisearch versions. A dump isn't an exact copy of your database—it is closer to a blueprint that allows you to rebuild an identical database. - -Snapshots, on the other hand, are an exact copy of your database. The documents in a snapshot are already "indexed" and ready to go, therefore they import faster than dumps. However, as a result, **snapshots are not compatible between different versions of Meilisearch.** You can schedule snapshots at regular intervals and use them for rolling back data. - -You can read more about [dumps](/learn/advanced/dumps) and [snapshots](/learn/advanced/snapshots) in their dedicated guides. - -## Multitenancy and tenant tokens - -Multi-tenant indexes store data belonging to different users in one index. In such situations, users should only be able to search through their own documents. Meilisearch allows you to do this with tenant tokens. - -Tenant tokens are small, short-lived packages of encrypted data that prove a user has access to a certain index. They contain security credentials and instructions on which documents the user is allowed to see within that index. You can generate tenant tokens using one of our [SDKs](/learn/security/tenant_tokens#generating-tenant-tokens-with-an-sdk) or [from scratch](/learn/security/tenant_tokens#generating-tenant-tokens-with-an-sdk). - -You can read more about tenant tokens and how to generate them in our [dedicated guide](/learn/security/tenant_tokens). - -## What's next - -Hopefully, these chapters have given you a basic introduction to Meilisearch and some of the things it can do. Once you get the hang of the basics, the possibilities are endless. To continue exploring Meilisearch, check out: - -- [Tasks and asynchronous workflow](/learn/async/asynchronous_operations) -- [API references](/reference/api/overview) -- [Configuration](/learn/configuration/instance_options)