Login
You're viewing the functional.cafe public feed.
  • Nov 18, 2026, 10:45 PM

    Remember when implementing a search function over objects that sorting the results that a simple sort by name is probably the worst possible option. Sure it's the easiest, but at least sort the matches that are better first.
    Something like:
    Whole word match
    Start of word match
    Rest

    Eg, if I search for 'ian' I really want 'Ian Smith' to be listed before 'Christian Jones'. Every time. All users want this.

    Other matches that might want to be sorted earlier:
    terms in sequence

    💬 2🔄 1⭐ 0

Replies

  • Nov 18, 2026, 10:48 PM

    And if you must implement search with implied OR of terms (this is a garbage tier dark pattern) at least sort the items with more matches first.

    Or more exact matches if also using synonym matching (diamond tier user friendly search).

    💬 1🔄 1⭐ 0
  • Nov 19, 2026, 12:21 AM

    @LovesTha No, you know what is worse?
    And, YES, it is done (Officeworks I'm looking at you).
    That is when, if you add more search terms, they "OR" them rather than "AND"-ing them.
    This is extremely unfriendly!

    💬 1🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • Nov 19, 2026, 1:56 AM

    @LovesTha Right? I usually do whole phrase match > n exact word matches > n start of word matches > rest, and fairly easy rankings like that are easy and will get you SO far on making search results more useful.

    💬 1🔄 0⭐ 0
  • Nov 19, 2026, 1:58 AM

    @LovesTha but like you say, just simple OR isn't often great, so I like to -- wait for it, it's a weird thing that a lot of people don't do -- think hard about each individual thing I'm doing searches for and how people will use it and how that means I should rank results.

    💬 0🔄 0⭐ 0