Custom ranking rules promote certain documents over other search results that are otherwise equally relevant.
There are two types of ranking rules in Meilisearch: built-in ranking rules and custom ranking rules. This article describes the main aspects of using and configuring custom ranking rules.
Meilisearch supports two types of custom rules: one for ascending sort and one for descending sort.To add a custom ranking rule, you have to communicate the attribute name followed by a colon (:) and either asc for ascending order or desc for descending order.
To apply an ascending sort (results sorted by increasing value of the attribute): attribute_name:asc
To apply a descending sort (results sorted by decreasing value of the attribute): attribute_name:desc
The attribute must have either a numeric or a string value in all of the documents contained in that index.
If some documents do not contain the attribute defined in a custom ranking rule, the application of the ranking rule is undefined and the search results might not be sorted as you expected. Make sure that any attribute used in a custom ranking rule is present in all of your documents.
Custom ranking rules sort results in lexicographical order. For example, Elena will rank higher than Ryu and lower than 11 in a descending sort.Since this operation does not take into consideration document relevancy, in the majority of cases you should place custom ranking rules after the built-in ranking rules. This ensures that results are first sorted by relevancy, and the lexicographical sorting takes place only when two or more documents share the same ranking score.Setting a custom ranking rule at a high position may result in a degraded search experience, since users will see documents in alphanumerical order instead of sorted by relevance.
Suppose you have a movie dataset. The documents contain the fields release_date with a timestamp as value, and movie_ranking, an integer that represents its ranking.The following example creates a rule that makes older movies more relevant than recent ones. A movie released in 1999 will appear before a movie released in 2020.
release_date:asc
The following example will create a rule that makes movies with a good rank more relevant than movies with a lower rank. Movies with a higher ranking will appear first.
movie_ranking:desc
The following array includes all built-in ranking rules and places the custom rules at the bottom of the processing order:
Meilisearch allows users to define sorting order at query time by using the sort search parameter. There is some overlap between sorting and custom ranking rules, but the two do have different uses.In general, sort will be most useful when you want to allow users to define what type of results they want to see first. A good use-case for sort is creating a webshop interface where customers can sort products by descending or ascending product price.Custom ranking rules, instead, are always active once configured and are useful when you want to promote certain types of results. A good use-case for custom ranking rules is ensuring discounted products in a webshop always feature among the top results.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Meilisearch Documentation","colors":{"primary":"#FF5CB2","light":"#FF5CB2","dark":"#FF5CB2"},"logo":{"light":"https://mintcdn.com/meilisearch-6b28dec2/YRn82YKcWv02OWrg/assets/repo/meilisearch-logo-light.svg?fit=max\u0026auto=format\u0026n=YRn82YKcWv02OWrg\u0026q=85\u0026s=331f9ce2d1f557db3b679795f4707aa5","dark":"https://mintcdn.com/meilisearch-6b28dec2/YRn82YKcWv02OWrg/assets/repo/meilisearch-logo-dark.svg?fit=max\u0026auto=format\u0026n=YRn82YKcWv02OWrg\u0026q=85\u0026s=81634cdd715f6f159c69841b5d539d5a"},"favicon":"https://mintcdn.com/meilisearch-6b28dec2/YRn82YKcWv02OWrg/assets/repo/favicon.svg?fit=max\u0026auto=format\u0026n=YRn82YKcWv02OWrg\u0026q=85\u0026s=33f47c7e13dd4d7005f570f6299328a5","api":{"playground":{"display":"simple"}},"appearance":{"default":"dark"},"background":{"decoration":"grid","color":{"light":"#F7F7F7","dark":"#1A003B"}},"navbar":{"links":[{"href":"https://www.meilisearch.com","label":"Website"},{"href":"https://github.com/meilisearch/meilisearch","label":"GitHub"},{"href":"https://discord.meilisearch.com/","label":"Discord"}],"primary":{"type":"button","label":"Start a trial","href":"https://cloud.meilisearch.com"}},"footer":{"socials":{"x":"https://x.com/meilisearch","github":"https://github.com/meilisearch","linkedin":"https://www.linkedin.com/company/meilisearch","website":"https://www.meilisearch.com"},"links":[{"header":"Product","items":[{"label":"Meilisearch Cloud","href":"https://www.meilisearch.com/cloud"},{"label":"AI search","href":"https://www.meilisearch.com/solutions/hybrid-search"},{"label":"Pricing","href":"https://www.meilisearch.com/pricing"},{"label":"Documentation","href":"https://www.meilisearch.com/docs"},{"label":"Roadmap","href":"https://roadmap.meilisearch.com"},{"label":"Release notes","href":"https://updates.cloud.meilisearch.com/"},{"label":"Comparisons","href":"https://www.meilisearch.com/docs/resources/comparisons/alternatives"},{"label":"Trust center","href":"https://trust.meilisearch.com/"}]},{"header":"Contact us","items":[{"label":"GitHub","href":"https://github.com/meilisearch"},{"label":"Discord","href":"https://discord.gg/meilisearch"},{"label":"Newsletter","href":"https://share-eu1.hsforms.com/1LN5N0x_GQgq7ss7tXmSykwfg3aq"},{"label":"Helpdesk","href":"https://help.meilisearch.com/"}]},{"header":"Company","items":[{"label":"Blog","href":"https://meilisearch.com/blog"},{"label":"Customers","href":"https://www.meilisearch.com/customers"},{"label":"Careers","href":"https://www.meilisearch.com/careers"},{"label":"Code of Conduct","href":"https://github.com/meilisearch/MeiliSearch/blob/main/CODE_OF_CONDUCT.md"},{"label":"Privacy Policy","href":"https://www.meilisearch.com/privacy-policy"},{"label":"Terms of Use","href":"https://www.meilisearch.com/terms-of-use"},{"label":"Swag","href":"https://swag.meilisearch.com/"}]}]},"seo":{"metatags":{"canonical":"https://www.meilisearch.com/docs"}},"integrations":{"fathom":{"siteId":"QNBPJXIV"},"gtm":{"tagId":"GTM-TNSCGVBH"},"posthog":{"apiKey":"phc_D5VtJkw6WyBzLtZ5tBvwR7ac4LvQZdFGYQTQfegRjh9n","apiHost":"https://t.meilisearch.com","sessionRecording":true},"segment":{"key":"KIC0Lcb5C9ssRY79dUKPOK8Wq6wLHiUP"}},"contextual":{"options":["copy","view","chatgpt","claude","cursor"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"meilisearch-6b28dec2","hasAudioNarration":false,"actualSubdomain":"meilisearch-6b28dec2","customDomains":["www.meilisearch.com","meilisearch.dev"],"gitSource":{"type":"github","owner":"meilisearch","repo":"documentation","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true,"edits":true,"issues":true,"agentFeedback":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"DISABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6af0669bb63e2f3c3ce2a349","clientVersion":"0.0.4087","searchFilterCounts":[{"language":"default","tag":"Capabilities","count":168},{"language":"default","tag":"Reference","count":150},{"language":"default","tag":"API Routes","count":143},{"language":"default","tag":"Changelog","count":114},{"language":"default","tag":"Resources","count":89},{"language":"default","tag":"Settings","count":69},{"language":"default","tag":"How to","count":62},{"language":"default","tag":"Getting started","count":53},{"language":"default","tag":"Advanced","count":30},{"language":"default","tag":"Self-hosting","count":29}]},"assistantConfig":{},"basePath":"/docs","hasChatPermissions":false,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"comment-mode","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":".dark\\:text-gray-400:is(.dark *){color:rgb(var(--gray-300))}#navigation-items h5{text-transform:uppercase}.callout h2,.callout h3,.callout h4,.callout h5,.callout h6{color:inherit}.noticeTag{color:rgb(var(--primary-light));border:1px solid rgb(var(--primary-light));padding:0 0.5em;margin-left:0.25em;display:inline-block;border-radius:5px;font-size:0.8em}.routeHighlighter{--route-highlighter-color: rgba(100, 100, 100, 0.35);display:flex;border-radius:0.375rem;border:1px var(--route-highlighter-color) solid;padding:1rem;gap:2rem;align-items:center;overflow:scroll}.routeHighlighter--GET{--route-highlighter-color: oklch(0.792 0.209 151.711)}.routeHighlighter--POST{--route-highlighter-color: oklch(0.623 0.214 259.815)}.routeHighlighter--DELETE{--route-highlighter-color: oklch(63.7% 0.237 25.331)}.routeHighlighter--PUT,.routeHighlighter--PATCH{--route-highlighter-color: oklch(0.828 0.189 84.429)}.routeHighlighter__method{font-weight:700;color:var(--route-highlighter-color)}.routeHighlighter__path{font-family:var(--font-jetbrains-mono),ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace}"},{"filePath":"meilisearch-search-bar.css","content":".meilisearch-bar-container{max-width:480px;width:100%;margin:0 auto;padding:0 10px}.meilisearch-search-bar{background-color:white;color:rgba(25, 25, 25, 0.7);border:1px solid rgba(255, 255, 255, 0.1);display:flex;align-items:center;border-radius:12px;padding:8px 16px;cursor:pointer;width:100%;transition:all 0.2s ease;backdrop-filter:blur(8px);font-size:14px}.dark .meilisearch-search-bar{background-color:rgba(25, 17, 53, 0.5);color:rgba(255, 255, 255, 0.7);border:1px solid rgba(255, 255, 255, 0.1)}.meilisearch-search-bar__text{flex-grow:1}.meilisearch-search-bar__shortcut{opacity:0.7;font-size:12px}.meilisearch-flexwrapper{display:flex;justify-content:center;align-items:center;width:100%}.meilisearch-modal-overlay{position:fixed;top:0;left:0;width:100%;height:100%;backdrop-filter:blur(8px);background-color:rgba(0, 0, 0, 0.4);z-index:9999;display:none;align-items:flex-start;justify-content:center;padding-top:0;box-sizing:border-box}.meilisearch-modal{background-color:#fff;border:1px solid rgba(0, 0, 0, 0.5);width:600px;max-width:90%;max-height:80vh;margin-top:70px;border-radius:12px;box-shadow:0 8px 32px rgba(0, 0, 0, 0.3);display:flex;flex-direction:column;overflow:hidden}.dark .meilisearch-modal{background-color:#1a1033;border:1px solid rgba(255, 255, 255, 0.1)}.meilisearch-modal__input-container{display:flex;align-items:center;padding:16px 20px;border-bottom:1px solid rgba(0, 0, 0, 0.1)}.dark .meilisearch-modal__input-container{border-bottom:1px solid rgba(255, 255, 255, 0.1)}.meilisearch-modal__input{background:transparent;border:none;font-size:16px;outline:none;width:100%;margin-right:10px;color:rgb(var(--gray-700))}.dark .meilisearch-modal__input{color:rgb(var(--gray-100))}.meilisearch-modal__escape{font-size:12px;padding:4px 8px;border-radius:4px;margin-left:auto;background-color:rgba(0, 0, 0, 0.1)}.dark .meilisearch-modal__escape{color:rgba(255, 255, 255, 0.5);background-color:rgba(255, 255, 255, 0.1)}.meilisearch-modal__results{flex-grow:1;overflow-y:auto;padding:0}.meilisearch-modal__indicator{padding:20px;text-align:center}.dark .meilisearch-modal__indicator{color:rgba(255, 255, 255, 0.7)}.meilisearch-modal__result{display:block;padding:12px 20px;text-decoration:none;border-left:3px solid transparent;transition:background-color 0.2s, border-color 0.2s}.dark .meilisearch-modal__result{color:white}.meilisearch-modal__result:hover{background-color:rgba(0, 0, 0, 0.05);border-left-color:#f472b6}.dark .meilisearch-modal__result:hover{background-color:rgba(255, 255, 255, 0.05)}.meilisearch-modal__category-header{padding:12px 20px 8px;font-size:14px;font-weight:600;text-transform:uppercase;color:rgba(0, 0, 0, 0.45)}.dark .meilisearch-modal__category-header{color:rgba(255, 255, 255, 0.5)}.meilisearch-modal__result-heading{font-weight:500;margin-bottom:4px}.meilisearch-modal__result-content{font-size:13px;color:rgba(0, 0, 0, 0.45)}.dark .meilisearch-modal__result-content{color:rgba(255, 255, 255, 0.6)}.meilisearch-modal__category-em{font-style:normal;color:#f472b6;font-weight:bold}.meilisearch-modal__error{padding:20px;text-align:center;color:#f87171}.meilisearch-filter-container{padding:16px 20px;border-bottom:1px solid rgba(0, 0, 0, 0.1);background-color:rgba(0, 0, 0, 0.02)}.dark .meilisearch-filter-container{border-bottom:1px solid rgba(255, 255, 255, 0.1);background-color:rgba(255, 255, 255, 0.02)}.meilisearch-filter-title{font-size:14px;font-weight:500;color:rgba(0, 0, 0, 0.7);margin-bottom:12px}.dark .meilisearch-filter-title{color:rgba(255, 255, 255, 0.7)}.meilisearch-filter-tags{display:flex;flex-wrap:wrap;gap:8px}.meilisearch-filter-tag{background-color:rgba(0, 0, 0, 0.05);border:1px solid rgba(0, 0, 0, 0.1);border-radius:6px;padding:6px 12px;font-size:13px;font-weight:500;color:rgba(0, 0, 0, 0.7);cursor:pointer;transition:all 0.2s ease;text-transform:capitalize}.dark .meilisearch-filter-tag{background-color:rgba(255, 255, 255, 0.05);border:1px solid rgba(255, 255, 255, 0.1);color:rgba(255, 255, 255, 0.7)}.meilisearch-filter-tag:hover{background-color:rgba(0, 0, 0, 0.1);border-color:rgba(0, 0, 0, 0.2)}.dark .meilisearch-filter-tag:hover{background-color:rgba(255, 255, 255, 0.1);border-color:rgba(255, 255, 255, 0.2)}.meilisearch-filter-tag.active{background-color:#f472b6;border-color:#f472b6;color:white}.meilisearch-filter-tag.active:hover{background-color:#cb4d86;border-color:#cb4d86}"}],"page":{"pagePath":"capabilities/full_text_search/relevancy/custom_ranking_rules","slug":"/capabilities/full_text_search/relevancy/custom_ranking_rules","pageMetadata":{"title":"Custom ranking rules","sidebarTitle":"Custom ranking rules","description":"Custom ranking rules promote certain documents over other search results that are otherwise equally relevant.","href":"/capabilities/full_text_search/relevancy/custom_ranking_rules"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Custom ranking rules promote certain documents over other search results that are otherwise equally relevant.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Heading,Tip,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Tip)_missingMdxReference(`Tip`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`There are two types of ranking rules in Meilisearch: `,_jsx(_components.a,{href:`/capabilities/full_text_search/relevancy/ranking_rules`,children:`built-in ranking rules`}),` and custom ranking rules. This article describes the main aspects of using and configuring custom ranking rules.`]}),`\n`,_jsx(Heading,{level:`2`,id:`ascending-and-descending-sorting-rules`,children:`Ascending and descending sorting rules`}),`\n`,_jsx(_components.p,{children:`Meilisearch supports two types of custom rules: one for ascending sort and one for descending sort.`}),`\n`,_jsxs(_components.p,{children:[`To add a custom ranking rule, you have to communicate the attribute name followed by a colon (`,_jsx(_components.code,{children:`:`}),`) and either `,_jsx(_components.code,{children:`asc`}),` for ascending order or `,_jsx(_components.code,{children:`desc`}),` for descending order.`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`To apply an `,_jsx(_components.strong,{children:`ascending sort`}),` (results sorted by increasing value of the attribute): `,_jsx(_components.code,{children:`attribute_name:asc`})]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`To apply a `,_jsx(_components.strong,{children:`descending sort`}),` (results sorted by decreasing value of the attribute): `,_jsx(_components.code,{children:`attribute_name:desc`})]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`The attribute must have either a numeric or a string value`}),` in all of the documents contained in that index.`]}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`If some documents do not contain the attribute defined in a custom ranking rule, the application of the ranking rule is undefined and the search results might not be sorted as you expected. Make sure that any attribute used in a custom ranking rule is present in all of your documents.`})}),`\n`,_jsxs(_components.p,{children:[`You can add this rule to the existing list of ranking rules using the `,_jsx(_components.a,{href:`/reference/api/settings/update-all-settings`,children:`update settings endpoint`}),` or `,_jsx(_components.a,{href:`/reference/api/settings/update-rankingrules`,children:`update ranking rules endpoint`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`how-to-use-custom-ranking-rules`,children:`How to use custom ranking rules`}),`\n`,_jsxs(_components.p,{children:[`Custom ranking rules sort results in lexicographical order. For example, `,_jsx(_components.code,{children:`Elena`}),` will rank higher than `,_jsx(_components.code,{children:`Ryu`}),` and lower than `,_jsx(_components.code,{children:`11`}),` in a descending sort.`]}),`\n`,_jsx(_components.p,{children:`Since this operation does not take into consideration document relevancy, in the majority of cases you should place custom ranking rules after the built-in ranking rules. This ensures that results are first sorted by relevancy, and the lexicographical sorting takes place only when two or more documents share the same ranking score.`}),`\n`,_jsx(_components.p,{children:`Setting a custom ranking rule at a high position may result in a degraded search experience, since users will see documents in alphanumerical order instead of sorted by relevance.`}),`\n`,_jsx(Heading,{level:`2`,id:`example`,children:`Example`}),`\n`,_jsxs(_components.p,{children:[`Suppose you have a movie dataset. The documents contain the fields `,_jsx(_components.code,{children:`release_date`}),` with a timestamp as value, and `,_jsx(_components.code,{children:`movie_ranking`}),`, an integer that represents its ranking.`]}),`\n`,_jsx(_components.p,{children:`The following example creates a rule that makes older movies more relevant than recent ones. A movie released in 1999 will appear before a movie released in 2020.`}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`release_date:asc`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})})}),`\n`,_jsx(_components.p,{children:`The following example will create a rule that makes movies with a good rank more relevant than movies with a lower rank. Movies with a higher ranking will appear first.`}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`movie_ranking:desc`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})})}),`\n`,_jsx(_components.p,{children:`The following array includes all built-in ranking rules and places the custom rules at the bottom of the processing order:`}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:``,numberOfLines:`11`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`11`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"words\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"typo\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"proximity\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"attributeRank\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"sort\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"wordPosition\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"exactness\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"release_date:asc\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"movie_ranking:desc\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})}),`\n`]})})})}),`\n`,_jsx(Heading,{level:`2`,id:`sorting-at-search-time-and-custom-ranking-rules`,children:`Sorting at search time and custom ranking rules`}),`\n`,_jsxs(_components.p,{children:[`Meilisearch allows users to define `,_jsx(_components.a,{href:`/capabilities/filtering_sorting_faceting/how_to/sort_results`,children:`sorting order at query time`}),` by using the `,_jsxs(_components.a,{href:`/reference/api/search/search-with-post#body-sort`,children:[_jsx(_components.code,{children:`sort`}),` search parameter`]}),`. There is some overlap between sorting and custom ranking rules, but the two do have different uses.`]}),`\n`,_jsxs(_components.p,{children:[`In general, `,_jsx(_components.code,{children:`sort`}),` will be most useful when you want to allow users to define what type of results they want to see first. A good use-case for `,_jsx(_components.code,{children:`sort`}),` is creating a webshop interface where customers can sort products by descending or ascending product price.`]}),`\n`,_jsx(_components.p,{children:`Custom ranking rules, instead, are always active once configured and are useful when you want to promote certain types of results. A good use-case for custom ranking rules is ensuring discounted products in a webshop always feature among the top results.`}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`Meilisearch does not offer native support for promoting, pinning, and boosting specific documents so they are displayed more prominently than other search results. Consult these Meilisearch blog articles for workarounds on `,_jsx(_components.a,{href:`https://blog.meilisearch.com/promoted-search-results-with-react-instantsearch`,children:`implementing promoted search results with React InstantSearch`}),` and `,_jsx(_components.a,{href:`https://blog.meilisearch.com/document-boosting`,children:`document boosting`}),`.`]})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Custom ranking rules","sidebarTitle":"Custom ranking rules","description":"Custom ranking rules promote certain documents over other search results that are otherwise equally relevant.","href":"/capabilities/full_text_search/relevancy/custom_ranking_rules"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Ascending and descending sorting rules","slug":"ascending-and-descending-sorting-rules","depth":2,"children":[]},{"title":"How to use custom ranking rules","slug":"how-to-use-custom-ranking-rules","depth":2,"children":[]},{"title":"Example","slug":"example","depth":2,"children":[]},{"title":"Sorting at search time and custom ranking rules","slug":"sorting-at-search-time-and-custom-ranking-rules","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/docs/_mintlify/custom/meilisearch-6b28dec2/c598d5c5cb296702/search.js","/docs/_mintlify/custom/meilisearch-6b28dec2/92f00249b2342156/cookieyes-banner.js","/docs/_mintlify/custom/meilisearch-6b28dec2/7302b02a474aa050/fathom-data-attr.js","/docs/_mintlify/custom/meilisearch-6b28dec2/85493af1bed6e7fb/gtm.js"],"subdomain":"meilisearch-6b28dec2","siteName":"Meilisearch Documentation","title":"Custom ranking rules - Meilisearch Documentation","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-04-30T15:54:53.415Z","originalFileLocation":"capabilities/full_text_search/relevancy/custom_ranking_rules.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"dark\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Custom ranking rules promote certain documents over other search results that are otherwise equally relevant.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Meilisearch Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/meilisearch-6b28dec2/6t6RePI0bXwGcKSs/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/docs/mintlify-assets/_mintlify/favicons/meilisearch-6b28dec2/6t6RePI0bXwGcKSs/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/meilisearch-6b28dec2/6t6RePI0bXwGcKSs/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/meilisearch-6b28dec2/6t6RePI0bXwGcKSs/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/meilisearch-6b28dec2/6t6RePI0bXwGcKSs/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/meilisearch-6b28dec2/6t6RePI0bXwGcKSs/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/meilisearch-6b28dec2/6t6RePI0bXwGcKSs/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/meilisearch-6b28dec2/6t6RePI0bXwGcKSs/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/meilisearch-6b28dec2/6t6RePI0bXwGcKSs/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Custom ranking rules - Meilisearch Documentation\">\u003cmeta data-mint-head property=\"og:description\" content=\"Custom ranking rules promote certain documents over other search results that are otherwise equally relevant.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Meilisearch Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://www.meilisearch.com/docs/capabilities/full_text_search/relevancy/custom_ranking_rules\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://meilisearch-6b28dec2.mintlify.site/docs/_mintlify/api/og/v2?division=Relevancy\u0026amp;title=Custom+ranking+rules\u0026amp;description=Custom+ranking+rules+promote+certain+documents+over+other+search+results+that+are+otherwise+equally+relevant.\u0026amp;theme=25515a5016844863e4538b41\u0026amp;signature=2a4102de26eada921fc69cfb923abe932be46a1bccb6e74503f245120b85f942\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Custom ranking rules - Meilisearch Documentation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Custom ranking rules promote certain documents over other search results that are otherwise equally relevant.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://meilisearch-6b28dec2.mintlify.site/docs/_mintlify/api/og/v2?division=Relevancy\u0026amp;title=Custom+ranking+rules\u0026amp;description=Custom+ranking+rules+promote+certain+documents+over+other+search+results+that+are+otherwise+equally+relevant.\u0026amp;theme=25515a5016844863e4538b41\u0026amp;signature=2a4102de26eada921fc69cfb923abe932be46a1bccb6e74503f245120b85f942\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/docs/mintlify-assets/_mintlify/favicons/meilisearch-6b28dec2/6t6RePI0bXwGcKSs/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Meilisearch Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#FF5CB2\">\u003clink data-mint-head rel=\"canonical\" href=\"https://www.meilisearch.com/docs/capabilities/full_text_search/relevancy/custom_ranking_rules\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/capabilities/full_text_search/relevancy/custom_ranking_rules.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://www.meilisearch.com/#organization\",\"name\":\"Meilisearch Documentation\",\"url\":\"https://www.meilisearch.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/meilisearch-6b28dec2/YRn82YKcWv02OWrg/assets/repo/meilisearch-logo-light.svg?fit=max\u0026auto=format\u0026n=YRn82YKcWv02OWrg\u0026q=85\u0026s=331f9ce2d1f557db3b679795f4707aa5\"}},{\"@type\":\"WebSite\",\"@id\":\"https://www.meilisearch.com/docs#website\",\"name\":\"Meilisearch Documentation\",\"url\":\"https://www.meilisearch.com/docs\",\"publisher\":{\"@id\":\"https://www.meilisearch.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://www.meilisearch.com/docs/capabilities/full_text_search/relevancy/custom_ranking_rules#webpage\",\"url\":\"https://www.meilisearch.com/docs/capabilities/full_text_search/relevancy/custom_ranking_rules\",\"name\":\"Custom ranking rules\",\"description\":\"Custom ranking rules promote certain documents over other search results that are otherwise equally relevant.\",\"dateModified\":\"2026-04-30T15:54:53.415Z\",\"isPartOf\":{\"@id\":\"https://www.meilisearch.com/docs#website\"},\"breadcrumb\":{\"@id\":\"https://www.meilisearch.com/docs/capabilities/full_text_search/relevancy/custom_ranking_rules#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://www.meilisearch.com/docs/capabilities/full_text_search/relevancy/custom_ranking_rules#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Full-text search\",\"item\":\"https://www.meilisearch.com/docs/capabilities/full_text_search/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Relevancy\",\"item\":\"https://www.meilisearch.com/docs/capabilities/full_text_search/relevancy/relevancy\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Custom ranking rules\",\"item\":\"https://www.meilisearch.com/docs/capabilities/full_text_search/relevancy/custom_ranking_rules\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://www.meilisearch.com/docs/capabilities/full_text_search/relevancy/custom_ranking_rules#article\",\"headline\":\"Custom ranking rules\",\"name\":\"Custom ranking rules\",\"description\":\"Custom ranking rules promote certain documents over other search results that are otherwise equally relevant.\",\"url\":\"https://www.meilisearch.com/docs/capabilities/full_text_search/relevancy/custom_ranking_rules\",\"mainEntityOfPage\":{\"@id\":\"https://www.meilisearch.com/docs/capabilities/full_text_search/relevancy/custom_ranking_rules#webpage\"},\"dateModified\":\"2026-04-30T15:54:53.415Z\",\"publisher\":{\"@id\":\"https://www.meilisearch.com/#organization\"},\"isPartOf\":{\"@id\":\"https://www.meilisearch.com/docs#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Meilisearch Documentation\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Meilisearch Documentation","nav":{"global":null,"tabs":[{"tab":"Getting started","pages":[{"title":"Getting started","href":"/getting_started/overview"}]},{"tab":"Capabilities","groups":[{"group":"Capabilities","pages":[{"title":"Capabilities overview","sidebarTitle":"Overview","href":"/capabilities/overview"}]},{"group":"Full-text search","pages":[{"title":"Full-text search","sidebarTitle":"Overview","href":"/capabilities/full_text_search/overview"},{"group":"Getting started","pages":[{"title":"Your first search","sidebarTitle":"Your first search","href":"/capabilities/full_text_search/getting_started/basic_search"},{"title":"Placeholder search","href":"/capabilities/full_text_search/getting_started/placeholder_search"},{"title":"Search with snippets","href":"/capabilities/full_text_search/getting_started/search_with_snippets"},{"title":"Phrase search","href":"/capabilities/full_text_search/getting_started/phrase_search"}]},{"group":"How to","pages":[{"title":"Configure searchable attributes","href":"/capabilities/full_text_search/how_to/configure_searchable_attributes"},{"title":"Configure stop words","href":"/capabilities/full_text_search/how_to/configure_stop_words"},{"title":"Configure prefix search","href":"/capabilities/full_text_search/how_to/configure_prefix_search"},{"title":"Configure a custom dictionary","sidebarTitle":"Configure dictionary","href":"/capabilities/full_text_search/how_to/configure_dictionary"},{"title":"Highlight search results","href":"/capabilities/full_text_search/how_to/highlight_search_results"},{"title":"Use matching strategy","href":"/capabilities/full_text_search/how_to/use_matching_strategy"},{"title":"Configure search cutoff","href":"/capabilities/full_text_search/how_to/configure_search_cutoff"},{"title":"Configure displayed attributes","sidebarTitle":"Configure displayed attributes","href":"/capabilities/full_text_search/how_to/configure_displayed_attributes"},{"title":"Configure distinct attribute","sidebarTitle":"Configure distinct attribute","href":"/capabilities/full_text_search/how_to/configure_distinct_attribute"},{"title":"Paginate search results","sidebarTitle":"Paginate results","href":"/capabilities/full_text_search/how_to/paginate_search_results"}]},{"group":"Relevancy","pages":[{"title":"Relevancy","sidebarTitle":"Relevancy","href":"/capabilities/full_text_search/relevancy/relevancy"},{"title":"Built-in ranking rules","sidebarTitle":"Built-in ranking rules","description":"Built-in ranking rules are the core of Meilisearch's relevancy calculations.","href":"/capabilities/full_text_search/relevancy/ranking_rules"},{"title":"Custom ranking rules","sidebarTitle":"Custom ranking rules","href":"/capabilities/full_text_search/relevancy/custom_ranking_rules"},{"title":"Ranking score","sidebarTitle":"Ranking score","description":"Learn how Meilisearch computes the _rankingScore for each document and which index settings influence it.","href":"/capabilities/full_text_search/relevancy/ranking_score"},{"title":"Attribute ranking order","sidebarTitle":"Attribute ranking order","href":"/capabilities/full_text_search/relevancy/attribute_ranking_order"},{"title":"Typo tolerance","sidebarTitle":"Typo tolerance","href":"/capabilities/full_text_search/relevancy/typo_tolerance_settings"},{"title":"Synonyms","sidebarTitle":"Synonyms","href":"/capabilities/full_text_search/relevancy/synonyms"}]},{"group":"Advanced","pages":[{"title":"Ranking pipeline","href":"/capabilities/full_text_search/advanced/ranking_pipeline"},{"title":"Performance tuning","sidebarTitle":"Performance tuning","href":"/capabilities/full_text_search/advanced/performance_tuning"},{"title":"Debug search performance","href":"/capabilities/full_text_search/advanced/debug_search_performance"}]}]},{"group":"Hybrid and semantic search","pages":[{"title":"Hybrid and semantic search","sidebarTitle":"Overview","href":"/capabilities/hybrid_search/overview"},{"title":"Getting started with AI-powered search","sidebarTitle":"Getting started","href":"/capabilities/hybrid_search/getting_started"},{"group":"How to","pages":[{"title":"Which embedder should I choose?","sidebarTitle":"Choose an embedder","href":"/capabilities/hybrid_search/how_to/choose_an_embedder"},{"title":"Use AI-powered search with user-provided embeddings","sidebarTitle":"Use AI-powered search with user-provided embeddings","href":"/capabilities/hybrid_search/how_to/search_with_user_provided_embeddings"},{"title":"Image search with multimodal embeddings","href":"/capabilities/hybrid_search/how_to/image_search_with_multimodal"},{"title":"Image search with user-provided embeddings","href":"/capabilities/hybrid_search/how_to/image_search_with_user_embeddings"}]},{"group":"Advanced","pages":[{"title":"Semantic vs hybrid search","href":"/capabilities/hybrid_search/advanced/semantic_vs_hybrid"},{"title":"Document template best practices","href":"/capabilities/hybrid_search/advanced/document_template_best_practices"},{"title":"Custom hybrid ranking","href":"/capabilities/hybrid_search/advanced/custom_hybrid_ranking"},{"title":"Composite embedders","href":"/capabilities/hybrid_search/advanced/composite_embedders"},{"title":"Binary quantization","sidebarTitle":"Binary quantization","href":"/capabilities/hybrid_search/advanced/binary_quantization"},{"title":"Multiple embedders","sidebarTitle":"Multiple embedders","href":"/capabilities/hybrid_search/advanced/multiple_embedders"},{"title":"Tune the `distribution` of semantic scores","href":"/capabilities/hybrid_search/advanced/tune_distribution"}]},{"group":"Providers","pages":[{"title":"Configure OpenAI embedder","sidebarTitle":"OpenAI","href":"/capabilities/hybrid_search/how_to/configure_openai_embedder"},{"title":"Configure Cohere embedder","sidebarTitle":"Cohere","href":"/capabilities/hybrid_search/how_to/configure_cohere_embedder"},{"title":"Configure HuggingFace embedder","sidebarTitle":"HuggingFace (local)","href":"/capabilities/hybrid_search/how_to/configure_huggingface_embedder"},{"title":"Configure a REST embedder","sidebarTitle":"REST (any API)","href":"/capabilities/hybrid_search/how_to/configure_rest_embedder"},{"title":"Semantic Search with Mistral Embeddings","sidebarTitle":"Mistral","href":"/capabilities/hybrid_search/providers/mistral"},{"title":"Semantic Search with Gemini Embeddings","sidebarTitle":"Google Gemini","href":"/capabilities/hybrid_search/providers/gemini"},{"title":"Semantic Search with Cloudflare Workers AI Embeddings","sidebarTitle":"Cloudflare Workers AI","href":"/capabilities/hybrid_search/providers/cloudflare"},{"title":"Semantic Search with Voyage AI Embeddings","sidebarTitle":"Voyage AI","href":"/capabilities/hybrid_search/providers/voyage"},{"title":"Semantic Search with AWS Bedrock Embeddings","sidebarTitle":"AWS Bedrock","href":"/capabilities/hybrid_search/providers/bedrock"},{"title":"Semantic Search with Jina Embeddings","sidebarTitle":"Jina","href":"/capabilities/hybrid_search/providers/jina"},{"title":"Multimodal search with TwelveLabs Marengo","sidebarTitle":"TwelveLabs","href":"/capabilities/hybrid_search/providers/twelvelabs"},{"title":"Semantic Search with Hugging Face Inference Endpoints","sidebarTitle":"HuggingFace Inference","href":"/capabilities/hybrid_search/providers/huggingface"}]}]},{"group":"Geo search","pages":[{"title":"Geo search","sidebarTitle":"Overview","href":"/capabilities/geo_search/overview"},{"title":"Geosearch","sidebarTitle":"Getting started","href":"/capabilities/geo_search/getting_started"},{"group":"How to","pages":[{"title":"Filter by geo radius","href":"/capabilities/geo_search/how_to/filter_by_geo_radius"},{"title":"Filter by geo bounding box","href":"/capabilities/geo_search/how_to/filter_by_geo_bounding_box"},{"title":"Filter by geo polygon","href":"/capabilities/geo_search/how_to/filter_by_geo_polygon"},{"title":"Sort by geo point","href":"/capabilities/geo_search/how_to/sort_by_geo_point"},{"title":"Use GeoJSON format","href":"/capabilities/geo_search/how_to/use_geojson_format"}]}]},{"group":"Agentic search","pages":[{"title":"What is agentic search?","sidebarTitle":"Overview","href":"/capabilities/agentic_search/overview"},{"title":"Getting started with agentic search","sidebarTitle":"Getting started","href":"/capabilities/agentic_search/getting_started"},{"group":"How to","pages":[{"title":"Configure guardrails","href":"/capabilities/agentic_search/how_to/configure_guardrails"},{"title":"Display source documents","href":"/capabilities/agentic_search/how_to/display_source_documents"},{"title":"Handle errors and fallbacks","href":"/capabilities/agentic_search/how_to/handle_errors_and_fallbacks"},{"title":"Optimize chat prompts","href":"/capabilities/agentic_search/how_to/optimize_chat_prompts"}]},{"group":"Advanced","pages":[{"title":"Reduce hallucination","href":"/capabilities/agentic_search/advanced/reduce_hallucination"},{"title":"Chats API","sidebarTitle":"Chats API (experimental)","href":"/capabilities/agentic_search/advanced/chats_api"}]}]},{"group":"Multi-search","pages":[{"title":"Multi-search","sidebarTitle":"Overview","href":"/capabilities/multi_search/overview"},{"group":"Getting started","pages":[{"title":"Multi-index search","sidebarTitle":"Multi-index search","href":"/capabilities/multi_search/getting_started/multi_search"},{"title":"Federated search","sidebarTitle":"Federated search","href":"/capabilities/multi_search/getting_started/federated_search"}]},{"group":"How to","pages":[{"title":"Boost results across indexes","sidebarTitle":"Boost results across indexes","href":"/capabilities/multi_search/how_to/boost_results_across_indexes"},{"title":"Search with different filters per index","sidebarTitle":"Search with different filters per index","href":"/capabilities/multi_search/how_to/search_with_different_filters"},{"title":"Build a unified search bar","sidebarTitle":"Build a unified search bar","href":"/capabilities/multi_search/how_to/build_unified_search_bar"},{"title":"Combine text and image search","href":"/capabilities/multi_search/how_to/combine_text_and_image_search"}]}]},{"group":"Filtering, sorting, and faceting","pages":[{"title":"Filtering, sorting, and faceting","sidebarTitle":"Overview","href":"/capabilities/filtering_sorting_faceting/overview"},{"title":"Filter search results","sidebarTitle":"Getting started","href":"/capabilities/filtering_sorting_faceting/getting_started"},{"group":"How to","pages":[{"title":"Search with facets","sidebarTitle":"Search with facets","href":"/capabilities/filtering_sorting_faceting/how_to/filter_with_facets"},{"title":"Search within facet values","sidebarTitle":"Facet search","href":"/capabilities/filtering_sorting_faceting/how_to/facet_search"},{"title":"Sort search results","sidebarTitle":"Sort search results","href":"/capabilities/filtering_sorting_faceting/how_to/sort_results"},{"title":"Filtering and sorting by date","sidebarTitle":"Filter and sort by date","href":"/capabilities/filtering_sorting_faceting/how_to/filter_and_sort_by_date"},{"title":"Combine filters and sort","sidebarTitle":"Combine filters and sort","href":"/capabilities/filtering_sorting_faceting/how_to/combine_filters_and_sort"},{"title":"Build faceted navigation","sidebarTitle":"Build faceted navigation","href":"/capabilities/filtering_sorting_faceting/how_to/build_faceted_navigation"},{"title":"Configure granular filterable attributes","href":"/capabilities/filtering_sorting_faceting/how_to/configure_granular_filters"},{"title":"Search and filter together","href":"/capabilities/filtering_sorting_faceting/how_to/search_and_filter_together"},{"title":"Handle large facet cardinality","href":"/capabilities/filtering_sorting_faceting/how_to/handle_large_facet_cardinality"}]},{"group":"Advanced","pages":[{"title":"Filter expression reference","sidebarTitle":"Filter expression reference","href":"/capabilities/filtering_sorting_faceting/advanced/filter_expression_syntax"},{"title":"Optimize facet performance","sidebarTitle":"Optimize facet performance","href":"/capabilities/filtering_sorting_faceting/advanced/optimize_facet_performance"},{"title":"Build disjunctive facets","sidebarTitle":"Disjunctive facets","href":"/capabilities/filtering_sorting_faceting/advanced/disjunctive_facets"},{"title":"Foreign filters","sidebarTitle":"Foreign filters","href":"/capabilities/filtering_sorting_faceting/advanced/filtering_by_joined_data"},{"title":"Precise filtering with array relationships","sidebarTitle":"Precise filtering with arrays","href":"/capabilities/filtering_sorting_faceting/advanced/precise_filtering_array_items"}]}]},{"group":"Personalization","pages":[{"title":"Personalization and recommendations","sidebarTitle":"Overview","href":"/capabilities/personalization/overview"},{"group":"Getting started","pages":[{"title":"Performing personalized search queries","sidebarTitle":"Personalized search","href":"/capabilities/personalization/getting_started/personalized_search"},{"title":"Building recommendations with similar documents","sidebarTitle":"Recommendations","href":"/capabilities/personalization/getting_started/recommendations"}]},{"group":"How to","pages":[{"title":"Generate user context","href":"/capabilities/personalization/how_to/generate_user_context"},{"title":"Personalize ecommerce search","href":"/capabilities/personalization/how_to/personalize_ecommerce_search"}]}]},{"group":"Analytics","pages":[{"title":"Analytics","sidebarTitle":"Overview","href":"/capabilities/analytics/overview"},{"title":"Configure analytics events","sidebarTitle":"Getting started","href":"/capabilities/analytics/getting_started"},{"group":"How to","pages":[{"title":"Bind search analytics events to a user","sidebarTitle":"Bind search analytics events to a user","href":"/capabilities/analytics/how_to/bind_events_to_user"},{"title":"Track click events","sidebarTitle":"Track click events","href":"/capabilities/analytics/how_to/track_click_events"},{"title":"Track conversion events","sidebarTitle":"Track conversion events","href":"/capabilities/analytics/how_to/track_conversion_events"},{"title":"Exclude search requests from analytics","sidebarTitle":"Exclude search requests from analytics","href":"/capabilities/analytics/how_to/ignore_search_requests"}]},{"group":"Advanced","pages":[{"title":"Analytics metrics reference","href":"/capabilities/analytics/advanced/analytics_metrics"},{"title":"Analytics events endpoint","href":"/capabilities/analytics/advanced/events_endpoint"},{"title":"Migrate to the November 2025 Meilisearch Cloud analytics","href":"/capabilities/analytics/advanced/migrate_analytics"}]}]},{"group":"Security and tenant tokens","pages":[{"title":"Security and tenant tokens","sidebarTitle":"Overview","href":"/capabilities/security/overview"},{"title":"Multitenancy and tenant tokens","sidebarTitle":"Getting started","href":"/capabilities/security/getting_started"},{"group":"How to","pages":[{"title":"Generate tenant tokens without a Meilisearch SDK","sidebarTitle":"Generate tenant tokens without a Meilisearch SDK","href":"/capabilities/security/how_to/generate_token_third_party"},{"title":"Generate a tenant token without a library","sidebarTitle":"Generate a tenant token without a library","href":"/capabilities/security/how_to/generate_token_from_scratch"},{"title":"Manage API keys","sidebarTitle":"Manage API keys","href":"/capabilities/security/how_to/manage_api_keys"}]},{"group":"Advanced","pages":[{"title":"Tenant token payload reference","sidebarTitle":"Tenant token payload reference","href":"/capabilities/security/advanced/tenant_token_payload"},{"title":"Role-based access control with joins","sidebarTitle":"RBAC with joins","href":"/capabilities/security/advanced/rbac_with_joins"}]}]},{"group":"Search rules","pages":[{"title":"Search rules","sidebarTitle":"Overview","href":"/capabilities/search_rules/overview"},{"title":"Create your first rule","sidebarTitle":"Getting started","href":"/capabilities/search_rules/create_your_first_rule"},{"group":"How to","pages":[{"title":"Pin several documents for a query","href":"/capabilities/search_rules/how_to/pin_multiple_results"},{"title":"Boost documents during a campaign","href":"/capabilities/search_rules/how_to/boost_documents"},{"title":"Deboost documents","href":"/capabilities/search_rules/how_to/deboost_documents"},{"title":"Hide documents from search results","href":"/capabilities/search_rules/how_to/hide_documents"},{"title":"List or filter existing rules","href":"/capabilities/search_rules/how_to/list_and_filter_rules"},{"title":"Pause a rule without deleting it","href":"/capabilities/search_rules/how_to/pause_a_rule"}]},{"group":"Advanced","pages":[{"title":"How search rules work","sidebarTitle":"How search rules work","href":"/capabilities/search_rules/advanced/how_search_rules_work"},{"title":"Specific behaviors","sidebarTitle":"Specific behaviors","href":"/capabilities/search_rules/advanced/specific_behaviors"}]},{"title":"Search rules pricing","sidebarTitle":"Pricing","href":"/capabilities/search_rules/pricing"}]},{"group":"Platform","pages":[{"title":"Meilisearch Cloud platform","sidebarTitle":"Overview","href":"/capabilities/platform/overview"},{"group":"Infrastructure","pages":[{"title":"Cloud infrastructure","sidebarTitle":"Overview","href":"/capabilities/platform/infrastructure/overview"},{"title":"Create a project","href":"/capabilities/platform/infrastructure/create_a_project"},{"title":"Cloud regions","href":"/capabilities/platform/infrastructure/regions"},{"title":"Manage resources","href":"/capabilities/platform/infrastructure/manage_resources"},{"title":"Version management","href":"/capabilities/platform/infrastructure/version_management"},{"title":"Sharding and replication","href":"/capabilities/platform/infrastructure/sharding_and_replication"},{"title":"Backups","href":"/capabilities/platform/infrastructure/backups"}]},{"group":"Monitoring","pages":[{"title":"Monitoring","sidebarTitle":"Overview","href":"/capabilities/platform/monitoring/overview"},{"title":"Search performance","href":"/capabilities/platform/monitoring/search_performance"},{"title":"Indexing performance","href":"/capabilities/platform/monitoring/indexing_performance"},{"title":"Operations","href":"/capabilities/platform/monitoring/usage_metrics"},{"title":"Prometheus endpoint","href":"/capabilities/platform/monitoring/prometheus_endpoint"}]},{"group":"Billing","pages":[{"title":"Billing","sidebarTitle":"Overview","href":"/capabilities/platform/billing/overview"},{"title":"Pricing model","href":"/capabilities/platform/billing/pricing_model"},{"title":"Invoices","href":"/capabilities/platform/billing/invoices"},{"title":"Payment methods","href":"/capabilities/platform/billing/payment_methods"}]},{"group":"Teams","pages":[{"title":"Meilisearch Cloud teams","sidebarTitle":"Overview","href":"/capabilities/platform/teams/overview"},{"title":"Getting started with teams","sidebarTitle":"Getting started","href":"/capabilities/platform/teams/getting_started"},{"group":"How to","pages":[{"title":"Manage team roles","href":"/capabilities/platform/teams/how_to/manage_team_roles"},{"title":"Configure SSO","sidebarTitle":"Configure SSO","href":"/capabilities/platform/teams/how_to/configure_sso_for_team"}]}]},{"group":"Security","pages":[{"title":"Meilisearch Cloud security","sidebarTitle":"Overview","href":"/capabilities/platform/security/overview"},{"title":"Manage the IP allowlist","href":"/capabilities/platform/security/manage_ip_allowlist"},{"title":"Disable the IP allowlist","href":"/capabilities/platform/security/disable_ip_allowlist"}]},{"group":"Management","pages":[{"title":"Project management","sidebarTitle":"Overview","href":"/capabilities/platform/management/overview"},{"title":"Webhooks","href":"/capabilities/platform/management/webhooks"},{"title":"Experimental features","href":"/capabilities/platform/management/experimental_features"}]}]},{"group":"Indexing","pages":[{"title":"Indexing","sidebarTitle":"Overview","href":"/capabilities/indexing/overview"},{"title":"Getting started with indexing","sidebarTitle":"Getting started","href":"/capabilities/indexing/getting_started"},{"group":"How to","pages":[{"title":"Add and update documents","href":"/capabilities/indexing/how_to/add_and_update_documents"},{"title":"Handling multilingual datasets","href":"/capabilities/indexing/how_to/handle_multilingual_data"},{"title":"Document relations","href":"/capabilities/indexing/how_to/document_relations"},{"title":"Export data to another instance","href":"/capabilities/indexing/how_to/export_data"},{"title":"Compact an index","href":"/capabilities/indexing/how_to/compact_an_index"},{"title":"Import large datasets","href":"/capabilities/indexing/how_to/import_large_datasets"},{"title":"Design primary keys","href":"/capabilities/indexing/how_to/design_primary_keys"},{"title":"Edit documents with functions","sidebarTitle":"Edit with functions","href":"/capabilities/indexing/how_to/edit_documents_with_functions"},{"title":"Delete documents at scale","href":"/capabilities/indexing/how_to/delete_documents_at_scale"}]},{"group":"Tasks and batches","pages":[{"title":"Tasks and asynchronous operations","sidebarTitle":"Tasks and asynchronous operations","href":"/capabilities/indexing/tasks_and_batches/async_operations"},{"title":"Working with tasks","sidebarTitle":"Working with tasks","href":"/capabilities/indexing/tasks_and_batches/monitor_tasks"},{"title":"Filtering tasks","sidebarTitle":"Filtering tasks","href":"/capabilities/indexing/tasks_and_batches/filter_tasks"},{"title":"Managing the task database","sidebarTitle":"Paginating tasks","href":"/capabilities/indexing/tasks_and_batches/manage_task_database"}]},{"group":"Joins","pages":[{"title":"Define index relationships","sidebarTitle":"Define index relationships","href":"/capabilities/indexing/joins/define_index_relationships"}]},{"group":"Advanced","pages":[{"title":"Indexing best practices","sidebarTitle":"Indexing best practices","href":"/capabilities/indexing/advanced/indexing_best_practices"},{"title":"Tokenization","sidebarTitle":"Tokenization","href":"/capabilities/indexing/advanced/tokenization"},{"title":"Optimize indexing performance with batch statistics","href":"/capabilities/indexing/tasks_and_batches/optimize_batch_performance"}]}]}]},{"tab":"Reference","pages":[{"title":"Reference","href":"/reference/api/authorization"}]},{"tab":"Resources","pages":[{"title":"Resources","href":"/resources/comparisons/alternatives"}]},{"tab":"Changelog","pages":[{"title":"Changelog","href":"/changelog"}]}]},"basePath":"","title":"Custom ranking rules - Meilisearch Documentation","buildId":"dpl_BSPUBxEoKhhK7HzXVDPxdPvWx4xc","deploymentId":"dpl_BSPUBxEoKhhK7HzXVDPxdPvWx4xc","dynamics":[],"chunks":[]}