Loosen examples
Every way to wire Loosen into a search page, on one real catalogue: 186 apartments around Lausanne. Open a variant, type filters that cannot match, and the widget explains which filters conflict and what to relax, one click each.
Guide: loosen.sicena.com/docs/install · Server: /docs/server · Data: data/README.md
This is the live demo of the loosen-examples repository: the same pages you get with ./serve.sh --with-server, plus a real loosend behind /api/ for variant 8. Fork or clone the repository to run them on your machine.
What you will see
Search rent ≤ 500 CHF, minutes to the centre ≤ 5, in Lausanne or Pully, with a balcony and a view: no result. The panel under your filters says (this is the real output of page 5):
Any of these changes gives results:
[Rent ≤ 706 CHF · 1 result] [Clear Features · 6 results] [Minutes to the centre ≤ 9 min + Clear Town · 1 result]
Why?
No results with Rent ≤ 500 CHF and Minutes to the centre ≤ 5 min and Features: balcony and view
[Rent ≤ 550 CHF] [Minutes to the centre ≤ 9 min] [Clear Features]
No results with Rent ≤ 500 CHF and Town is Lausanne or Pully and Features: balcony and view
[Rent ≤ 550 CHF] [Clear Town] [Clear Features]
Each chip applies the change to your filters (fields, state object, URL), your list refreshes, and an Undo button appears. Two searches with no result in this catalogue: rent ≤ 400 + not furnished + metro M1 and rent ≤ 600 + centre ≤ 5 min + parking; every page has buttons for them.
Not only zero results: minItems
Loosen also helps when a few results are left. Every variant has a field Suggest changes when fewer than [N] results (default 1: only when nothing matches). Try: rent ≤ 1200, rooms ≥ 3 finds one apartment; with N = 3 the widget offers Rent ≤ 1380 CHF · 3 results and Rooms ≥ 2 · 40 results.
One click: client mode, fromForm, by hand; the buttons “at least 3 results” on the other pages do the same.
The widget speaks eight languages
Every example page has a language switch in the header (Català, Español, English, Français, Português, 中文, 日本語, العربية). It sets <html lang dir> and ?lang=, and the widget is mounted again in that language on the same data. Arabic is laid out right to left. Try Arabic, Japanese, or the fully French page.
The variants
1Client mode, ES module
mountfromvendor/loosen.mjs. Data as an array, a URL or an async function.2Classic
<script>window.Loosenfrom the IIFE build, for sites without modules.3Plain form:
fromFormThe thesis form as ordinary HTML (numbers, towns, yes/no radios) and a live result table.
4By hand
Your own markup: explicit
getConstraints,applyRelaxation,restoreConstraints,onPreview.5Facet state object
An Algolia / Typesense / Meilisearch style UI: checkbox facets and range sliders around one state object.
6React 18
A real React app (vendored UMD, no build, no JSX):
useLoosenwith a ref and an effect. Tested.7Server-rendered shop needs ./serve.sh --with-server
Filters in the URL, results rendered by a Go program (stdlib only), relaxations navigate to the new URL. Back is the Undo.
8Server mode:
loosendneeds ./serve.sh --with-serverThe analysis runs on your Loosen server; read key, CORS, catalogue loaded with
curl. Docker, binary or compose.9Options playground
Toggle every option live, watch the event stream, theme with CSS custom properties, override texts, keyboard notes.
10Interface en français
The Lausanne apartments with a French host page: attribute labels from the original French database, CHF in
fr-CH,lang: "fr", correct plurals.