Add is_special to products sortableAttributes #6

Closed
opened 2026-09-17 22:44:05 +00:00 by david · 0 comments
Owner

Summary

Add is_special to sortableAttributes in shoppy-products.json, so the BFF's specials_first category-listing sort (is_special:desc) is a valid Meilisearch sort.

Background

Cross-repo dependency of product-sync#11. The BFF (~/Projects/bff, ADR-0002) sorts category listings by is_special:desc, and product-sync emits that field into each product document. But Meilisearch's sortableAttributes is an explicit allow-list, not "everything is sortable by default": a sort on an attribute absent from the list is rejected with HTTP 400 invalid_search_sort ("Attribute is_special is not sortable. Available sortable attributes are: ...").

The products settings listed only price.amountAsCents, price.comparativePricing.priceAsCents, and categoryListingRank, so the BFF sort would 400 against any index built from these settings.

Implementation Details

  • Add "is_special" to sortableAttributes in shoppy-products.json.
  • Update the settings table in README.md to match.

Notes / follow-ups

  • The settings file alone is not enough. product-sync applies these settings only when it creates an index, so an existing index keeps its old sortableAttributes until the settings are re-applied out-of-band (PATCH /indexes/<index>/settings) — and the documents only carry is_special after a re-sync.
  • The local default path used by product-sync is ~/Projects/shoppy/indexes/shoppy-test.json (the shoppy monorepo copy), which still lacks is_special. Confirming that copy is superseded by this repo is tracked separately.

Acceptance Criteria

  • shoppy-products.json lists is_special under sortableAttributes.
  • README.md settings table matches.

Test Plan

  • PATCH /indexes/<index>/settings with shoppy-products.json, then GET /indexes/<index>/settings/sortable-attributes includes is_special.
  • A search with sort: ["is_special:desc"] returns 200 and orders 210.
## Summary Add `is_special` to `sortableAttributes` in `shoppy-products.json`, so the BFF's `specials_first` category-listing sort (`is_special:desc`) is a valid Meilisearch sort. ## Background Cross-repo dependency of `product-sync#11`. The BFF (`~/Projects/bff`, ADR-0002) sorts category listings by `is_special:desc`, and `product-sync` emits that field into each product document. But Meilisearch's `sortableAttributes` is an **explicit allow-list**, not "everything is sortable by default": a sort on an attribute absent from the list is rejected with `HTTP 400 invalid_search_sort` ("Attribute `is_special` is not sortable. Available sortable attributes are: ..."). The products settings listed only `price.amountAsCents`, `price.comparativePricing.priceAsCents`, and `categoryListingRank`, so the BFF sort would 400 against any index built from these settings. ## Implementation Details - Add `"is_special"` to `sortableAttributes` in `shoppy-products.json`. - Update the settings table in `README.md` to match. ## Notes / follow-ups - **The settings file alone is not enough.** `product-sync` applies these settings only when it *creates* an index, so an existing index keeps its old `sortableAttributes` until the settings are re-applied out-of-band (`PATCH /indexes/<index>/settings`) — and the documents only carry `is_special` after a re-sync. - The local default path used by `product-sync` is `~/Projects/shoppy/indexes/shoppy-test.json` (the shoppy monorepo copy), which still lacks `is_special`. Confirming that copy is superseded by this repo is tracked separately. ## Acceptance Criteria - [ ] `shoppy-products.json` lists `is_special` under `sortableAttributes`. - [ ] `README.md` settings table matches. ## Test Plan - [ ] `PATCH /indexes/<index>/settings` with `shoppy-products.json`, then `GET /indexes/<index>/settings/sortable-attributes` includes `is_special`. - [ ] A search with `sort: ["is_special:desc"]` returns `200` and orders `2` → `1` → `0`.
david closed this issue 2026-09-20 03:26:19 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
shoppy/shoppy-index-configuration#6
No description provided.