Skip to content

Improve FTS search: ordering, result limits and 2-column display#6733

Open
meyerlor wants to merge 1 commit into3liz:masterfrom
meyerlor:improve/fts-search-ordering-and-display
Open

Improve FTS search: ordering, result limits and 2-column display#6733
meyerlor wants to merge 1 commit into3liz:masterfrom
meyerlor:improve/fts-search-ordering-and-display

Conversation

@meyerlor
Copy link
Copy Markdown
Collaborator

  • Switch similarity() to word_similarity() so short search terms (e.g. "106") score equally for all labels containing the term as a whole word, letting the secondary ORDER BY item_label produce a clean alphabetical list
  • Raise SQL fetch limit (40→500), per-layer cap (30→50) and total cap (60→100) to prevent late-alphabet results being silently dropped
  • Widen search panel (max-width 70%→85%), cap height at 95%
  • Apply 2-column layout via CSS :has() only when a category has 11+ results; each item is capped at 280px with word wrapping
grafik

- Switch similarity() to word_similarity() so short search terms (e.g. "106")
  score equally for all labels containing the term as a whole word, letting
  the secondary ORDER BY item_label produce a clean alphabetical list
- Raise SQL fetch limit (40→500), per-layer cap (30→100) and total cap
  (60→200) to prevent late-alphabet results being silently dropped
- Widen search panel (max-width 70%→85%), cap height at 95%
- Apply 2-column layout via CSS :has() only when a category has 11+
  results; each item is capped at 280px with word wrapping
@meyerlor
Copy link
Copy Markdown
Collaborator Author

I admit this is maybe questionable, and especially the values how many results per layer / in total should be displayed is set kind of randomly. But imho, this improves the search a bit for imprecise search terms, giving more results in a 2-column layout. No hard feelings if you reject this!

@rldhont rldhont requested review from mdouchin and rldhont April 13, 2026 13:34
@mdouchin
Copy link
Copy Markdown
Collaborator

Love it !

@mdouchin
Copy link
Copy Markdown
Collaborator

mdouchin commented Apr 17, 2026

We should really activate autocompletion for these searches. Not trivial to do since there are different providers, but it would be awesome to have.

I built a quick hack for this website :
https://sig.gard.fr/index.php/view/map/?repository=risques&project=zi_gard

See the related files

This is just to see "what it could do". The code is quite old and not really maintained (some ref to OpenLayers 2 functions ...)

@meyerlor
Copy link
Copy Markdown
Collaborator Author

meyerlor commented Apr 17, 2026

ouhw, autocomplete would be loveley, indeed. I had it not on my list but now that you mention it..!

What i had on my list was "upward pointing children search" (dunno how to explain it - search for a child of a 1:n related relation, get the parent feature as result)

@mdouchin
Copy link
Copy Markdown
Collaborator

ouhw, autocomplete would be loveley, indded. I had it not on my list but now that you mention it..!

What i had on my list was "upward pointing children search" (dunno how to explain it - search for a child of a 1:n related relation, get the parent feature as result)

Nice to have too !
NB: I edited my previous post with embedded files

@meyerlor
Copy link
Copy Markdown
Collaborator Author

meyerlor commented Apr 18, 2026

The site is down (or i can not access it?) but i'm going through your files now. I'll draft a dedicated PR for autocompletion if i can make it work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants