Smal
This commit is contained in:
parent
d34478e13c
commit
1934a38677
5 changed files with 66 additions and 9 deletions
|
|
@ -827,6 +827,18 @@ impl PropertyData {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reclaim geometric-growth slack. `address_search_token_keys` and the
|
||||
// posting lists are built by repeated `push`, so their capacity rounds up
|
||||
// to the next doubling step; at full UK scale (88M row-token keys, 39M
|
||||
// postings) that slack is ~250MB of permanently-resident waste. These
|
||||
// tables live for the whole process, so shrinking once at build time is
|
||||
// a pure win with no behaviour change.
|
||||
address_search_token_keys.shrink_to_fit();
|
||||
for postings in address_token_index.values_mut() {
|
||||
postings.shrink_to_fit();
|
||||
}
|
||||
|
||||
// Keep every distinctive token: common road words ("high", "church", "station") are
|
||||
// exactly what people search, and dropping them made those roads unsearchable while a
|
||||
// prefix fallback surfaced the wrong street ("Highbury" for "High"). The candidate scan
|
||||
|
|
@ -838,7 +850,10 @@ impl PropertyData {
|
|||
.max()
|
||||
.unwrap_or(0);
|
||||
let address_prefix_index = build_address_prefix_index(&address_token_index);
|
||||
let address_search_interner = address_search_rodeo.into_reader();
|
||||
// Resolve-only view: scoring only ever calls `.resolve(spur)`, never
|
||||
// `.get(str)`, so we drop the string->key reverse map that a RodeoReader
|
||||
// would keep (~tens of MB of hashmap we never touch).
|
||||
let address_search_interner = address_search_rodeo.into_resolver();
|
||||
let address_postings_count: usize = address_token_index.values().map(Vec::len).sum();
|
||||
tracing::info!(
|
||||
tokens = address_token_index.len(),
|
||||
|
|
@ -861,6 +876,9 @@ impl PropertyData {
|
|||
.or_default()
|
||||
.push(new_row as u32);
|
||||
}
|
||||
for rows in postcode_row_index.values_mut() {
|
||||
rows.shrink_to_fit();
|
||||
}
|
||||
let postcode_interner = postcode_rodeo.into_reader();
|
||||
|
||||
let row_to_poi_metric_idx: Vec<u32> = if poi_metrics.is_empty() {
|
||||
|
|
|
|||
|
|
@ -88,7 +88,8 @@ pub struct PropertyData {
|
|||
/// Prefix lookup from typed address-token prefix to indexed full address tokens.
|
||||
address_prefix_index: FxHashMap<String, Vec<String>>,
|
||||
/// Interned normalized address-search tokens used for per-row scoring.
|
||||
address_search_interner: lasso::RodeoReader,
|
||||
/// Resolve-only (no string->key reverse map): scoring only resolves keys.
|
||||
address_search_interner: lasso::RodeoResolver,
|
||||
/// Flat per-row normalized address-search token keys.
|
||||
address_search_token_keys: Vec<lasso::Spur>,
|
||||
/// Offset into `address_search_token_keys` for each row.
|
||||
|
|
@ -243,7 +244,7 @@ impl PropertyData {
|
|||
postcode_row_index: FxHashMap::default(),
|
||||
address_token_index: FxHashMap::default(),
|
||||
address_prefix_index: FxHashMap::default(),
|
||||
address_search_interner: lasso::Rodeo::default().into_reader(),
|
||||
address_search_interner: lasso::Rodeo::default().into_resolver(),
|
||||
address_search_token_keys: Vec::new(),
|
||||
address_search_token_offsets: Vec::new(),
|
||||
address_search_token_lengths: Vec::new(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue