@stapel/search-react 0.42.2 → 0.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -68,6 +68,7 @@ import type {
68
68
  SearchRange,
69
69
  } from "../api/types.js";
70
70
  import { withheldSlugs } from "../api/types.js";
71
+ import { featureAllowsFaceting } from "./facets.js";
71
72
 
72
73
  /**
73
74
  * Value types a numeric range row is drawn for (`config.type`, the
@@ -370,6 +371,12 @@ export function isRangeFeature(feature: FeatureDef): boolean {
370
371
  * seven numeric attributes a phone category happens to declare are all
371
372
  * shipping and wholesale inputs; the one number a phone buyer narrows by is
372
373
  * the price, and it belongs above them.
374
+ *
375
+ * That sentence stood here for several releases as an observation, and it was
376
+ * a BUG REPORT: those inputs are not the buyer's to see at all, and the
377
+ * catalogue had said so all along. `facet: false` is the opt-out and the loop
378
+ * below now reads it (`featureAllowsFaceting`) — see the note at the push.
379
+ * Ordering was the wrong cure for a row that should not be drawn.
373
380
  */
374
381
  export function buildRangeGroups(
375
382
  input: BuildRangeGroupsInput
@@ -393,6 +400,18 @@ export function buildRangeGroups(
393
400
  // server does with it (`index_schema.CORE_RANGE_FIELDS` reserves the
394
401
  // slug), so drawing both would put two controls over one filter.
395
402
  if (core.has(feature.slug)) continue;
403
+ // THE CATALOGUE'S OWN OPT-OUT, on the one path that never asked for it
404
+ // (D74). `facet: false` says the seller states this about the SALE — the
405
+ // parcel's weight, the minimum order — and on a live laptops leaf the six
406
+ // features carrying it were six of the seven from/to rows a buyer of
407
+ // second-hand laptops was offered. The discrete half is built from the
408
+ // ANSWER, which the engine has already filtered by this flag; this half is
409
+ // built from the raw schema, so it applies the flag itself. A slug this
410
+ // answer MEASURED is exempt — the server publishing bounds for it is the
411
+ // server saying it counted it — and a slug the URL constrains gets its row
412
+ // from the state loop below, so a stale link keeps the control that
413
+ // clears it.
414
+ if (!reported.has(feature.slug) && !featureAllowsFaceting(feature)) continue;
396
415
  // The schema's own numeric types, PLUS anything this answer measured: a
397
416
  // vocabulary-backed `year` is a choice in the catalogue and a from/to on
398
417
  // the page, and the server measuring it is the fact that settles it.