20 lines
5.6 KiB
HTML
20 lines
5.6 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Relevance ranking for search results."><title>jellytau_lib::domain::search_rank - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-17e0aaed.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="jellytau_lib" data-themes="" data-resource-suffix="" data-rustdoc-version="1.97.1 (8bab26f4f 2026-07-14)" data-channel="1.97.1" data-search-js="search-fd9372ac.js" data-stringdex-js="stringdex-2da4960a.js" data-settings-js="settings-170eb4bf.js" ><script src="../../../static.files/storage-41dd4d93.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-fcd733ba.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-f7c3ffd8.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><a class="skip-main-content" href="#main-content">Skip to main content</a><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module search_rank</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../jellytau_lib/index.html">jellytau_<wbr>lib</a><span class="version">0.10.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module search_<wbr>rank</a></h2><h3><a href="#enums">Module Items</a></h3><ul class="block"><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In jellytau_<wbr>lib::<wbr>domain</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content" tabindex="-1"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">jellytau_lib</a>::<wbr><a href="../index.html">domain</a></div><h1>Module <span>search_<wbr>rank</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/jellytau_lib/domain/search_rank.rs.html#1-314">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Relevance ranking for search results.</p>
|
||
<p>Both search paths (the SQLite FTS cache and the Jellyfin server) return items
|
||
in an order that ignores <em>where</em> in the name the query matched: a server
|
||
substring hit like “Sparks of Love” can outrank “Parks and Recreation” for
|
||
the query “parks”. Neither backend is going to change, so the app imposes its
|
||
own ordering on the union.</p>
|
||
<p>Ranking is domain logic, not presentation: it encodes what a “better match”
|
||
means and which media kinds outrank which. The frontend only renders the
|
||
order it is given.</p>
|
||
<p>Two rules, in priority order:</p>
|
||
<ol>
|
||
<li><strong>Match position</strong> — a prefix match beats a word-start match, which beats
|
||
a mid-word substring match. This is what makes “parks” find
|
||
“Parks and Recreation” before “Sparks of Love”.</li>
|
||
<li><strong>Kind</strong> — containers before their contents at equal match quality, so a
|
||
series outranks its own episodes.</li>
|
||
</ol>
|
||
<p>Ties fall back to the input order, so a backend’s own relevance signal (FTS
|
||
<code>rank</code>) still breaks ties it was never overruled on.</p>
|
||
</div></details><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.MatchQuality.html" title="enum jellytau_lib::domain::search_rank::MatchQuality">Match<wbr>Quality</a></dt><dd>How well a query matched an item’s name — better matches sort first.</dd></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.kind_rank.html" title="fn jellytau_lib::domain::search_rank::kind_rank">kind_<wbr>rank</a><span title="Restricted Visibility"> 🔒</span> </dt><dd>Rank of a media kind when match quality ties — lower sorts first.</dd><dt><a class="fn" href="fn.match_quality.html" title="fn jellytau_lib::domain::search_rank::match_quality">match_<wbr>quality</a></dt><dd>Classify how <code>query</code> matches <code>name</code>, case-insensitively.</dd><dt><a class="fn" href="fn.rank_search_results.html" title="fn jellytau_lib::domain::search_rank::rank_search_results">rank_<wbr>search_<wbr>results</a></dt><dd>Sort search results by relevance to <code>query</code>, in place.</dd></dl></section></div></main></body></html> |