/** * Ranking weights of the DeD building search. * * There are two layers and they are deliberately separate: * * 1. The tsvector weight classes (A/B/C/D) are baked into mv_ded_building_search by the migration - * A = name + designation + registration unit (evidenční jednotka) name, B = main address, * C = secondary addresses, D = identifiers + registration unit code. Changing those requires a * migration and a refresh. tsRank below is the weight array ts_rank_cd applies to them, in * Postgres order {D, C, B, A}. * 2. Everything else is applied at query time and can be retuned without a release. */ export interface IDedSearchWeights { /** ts_rank_cd weight array in Postgres order {D, C, B, A}. */ readonly tsRank: readonly [number, number, number, number]; /** Share of the full-text rank in the final score. */ readonly ftsRank: number; /** Share of the trigram similarity against the building name. */ readonly nameTrigram: number; /** Share of the trigram similarity against the addresses. */ readonly addressTrigram: number; /** Flat bonus when the name starts with the query. */ readonly prefixBonus: number; /** Tie-break bonus for buildings the map can zoom to. */ readonly geometryBonus: number; /** Tie-break bonus for buildings with at least one active consumption point. */ readonly activePointsBonus: number; /** Multiplier applied to GIDs with no eno_budova record. */ readonly missingBuildingPenalty: number; /** Results scoring below this are dropped. Exact matches always pass. */ readonly minScore: number; } /** * Reasoning for the defaults: * - tsRank {0.05, 0.2, 0.5, 1.0}: the name is the most distinctive field, the main address is worth * half of it so a name hit outranks an address hit, secondary addresses stay at the Postgres * default, and identifiers sit near zero because identifier queries are answered by the exact * tier - class D only helps partially typed identifiers surface at all. * - ftsRank 0.45: the primary relevance signal, but under half so it cannot alone dominate. * - nameTrigram 0.30: typing Czech without diacritics is the normal case, not an error case. * - addressTrigram 0.15: half of the name weight, mirroring the A/B ratio of layer 1. * - prefixBonus 0.30: in a suggest box, what was typed at the start is strong evidence of intent. * - geometryBonus / activePointsBonus 0.05: tie-breaks only, never enough to reorder real relevance. * - missingBuildingPenalty 0.80: mapping-only GIDs must stay findable but rank below described * buildings; multiplicative so it scales with confidence. */ export declare const DED_SEARCH_WEIGHTS_DEFAULT: IDedSearchWeights; /** Score assigned to an exact identifier or GID match. Its own tier, not a weight. */ export declare const DED_SEARCH_EXACT_SCORE = 1000; /** * Size of the candidate pool each non-exact tier contributes before scoring. Both tiers rank inside * their own CTE and truncate deterministically, so raising these widens what can be scored at the * cost of running the unindexable ranking functions over more rows. */ export declare const DED_SEARCH_FTS_CANDIDATES = 100; /** Rows admitted to the candidate pool from the trigram nearest-neighbour tier. */ export declare const DED_SEARCH_FUZZY_CANDIDATES = 50; export declare const DED_SEARCH_LIMIT_DEFAULT = 10; export declare const DED_SEARCH_LIMIT_MAX = 50; export declare const DED_SEARCH_QUERY_MAX_LENGTH = 100;