Search
sereto.tui.search
¶
FuzzyMatcher
¶
Source code in sereto/tui/search.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | |
highlight(text)
¶
Highlight fuzzy matches in the given text.
Source code in sereto/tui/search.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | |
ParsedSearchQuery
dataclass
¶
Structured representation of the raw search bar input.
Source code in sereto/tui/search.py
58 59 60 61 62 63 64 65 66 67 68 | |
SearchDiagnostics
dataclass
¶
Structured scoring details for one ranked result.
Attributes:
| Name | Type | Description |
|---|---|---|
free_text_score |
float
|
Aggregate contribution from untagged free-text terms. |
clause_score |
float
|
Aggregate contribution from explicit field clauses. |
phrase_bonus |
float
|
Extra score added when the full free-text phrase appears in a high-value field such as name or keyword. |
final_score |
float
|
Final score after combining weighted contributions and bonuses. |
passed_threshold |
bool
|
Whether the final score passed the display cutoff. |
field_scores |
dict[str, float]
|
Weighted field contributions keyed by field name. |
Source code in sereto/tui/search.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
SearchDocument
dataclass
¶
Searchable representation of one indexed finding template.
Source code in sereto/tui/search.py
71 72 73 74 75 76 | |
SearchField
dataclass
¶
Description of one searchable field in the finding index.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Canonical field name used internally and in the query syntax. |
label |
str
|
Human-readable label used in the UI and explanations. |
aliases |
tuple[str, ...]
|
Alternative operator names accepted in the query, such as
short forms like |
default_weight |
float
|
Relative importance of this field for free-text terms that do not explicitly target a field. Free-text search evaluates the term against every field and then
multiplies the field score by |
clause_weight |
float
|
Relative importance of this field when the user writes
an explicit field clause such as Clause scores are combined using a weighted average, so this value
only needs to express importance relative to the other fields. It
also does not need to add up to |
previewable |
bool
|
Whether matches in this field should also be highlighted in the finding preview screen. |
Source code in sereto/tui/search.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
SearchFieldRegistry
¶
Registry of supported search fields and their query operators.
Source code in sereto/tui/search.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
resolve(value, allow_prefix=False)
¶
Resolve a query operator to a registered search field.
Source code in sereto/tui/search.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
SearchReason
dataclass
¶
Explanation of why a document matched a query.
Source code in sereto/tui/search.py
79 80 81 82 83 84 85 | |
SearchResult
dataclass
¶
Ranked search result together with its scoring metadata.
Source code in sereto/tui/search.py
88 89 90 91 92 93 94 95 | |
build_matchers(query, fields)
¶
Create field-specific matchers for highlighting query terms.
Source code in sereto/tui/search.py
261 262 263 264 265 266 267 268 269 270 271 | |
is_search_debug_visible()
¶
Return whether inline search diagnostics should be shown in the TUI.
Source code in sereto/tui/search.py
15 16 17 18 | |
parse_search_query(query, fields)
¶
Parse the raw search string into free-text terms and field clauses.
Free-text terms are used for the default search mode, which primarily
targets finding names, keywords, and group hints. Tokens in the form
field:value are
parsed as explicit field clauses when field matches a registered
field name or alias.
Source code in sereto/tui/search.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | |
rank_documents(documents, query, fields)
¶
Rank documents by combining free-text and field-specific matches.
The ranking pipeline has two main inputs:
- free-text terms, weighted using
SearchField.default_weight - explicit field clauses, weighted using
SearchField.clause_weight
The returned score is a relative ranking value in the 0 to 100
range. The weighting values are tuning multipliers and are not expected to
form a normalized distribution.
Source code in sereto/tui/search.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | |
should_display_result(score)
¶
Return whether a ranked result is strong enough to display.
Source code in sereto/tui/search.py
328 329 330 | |
summarize_query(query, fields)
¶
Render the parsed query back into a compact user-facing summary.
Source code in sereto/tui/search.py
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | |
supported_operator_text(fields)
¶
Render the static help text listing the supported field operators.
Source code in sereto/tui/search.py
322 323 324 325 | |