Skip to content

Improve search by letting Alfred filter results - #131

Open
shreve wants to merge 2 commits into
jsumners:masterfrom
shreve:improve-search
Open

shreve wants to merge 2 commits into
jsumners:masterfrom
shreve:improve-search

Conversation

@shreve

@shreve shreve commented Jun 2, 2026

Copy link
Copy Markdown
  • The code in this PR was 100% written by me, the person opening the PR.

I use this workflow every day, multiple times per day, so first of all, thanks!

My biggest frustration is that when I search for an emoji I use quite frequently, even when my query is the full name, "purple heart", 💜 isn't the first result. This PR turns on the alfredfiltersresults option (set to "Word matching - any order" mode) and adds a "match" property to support filtering based on alternate names. This results in a much better emoji search experience.

A great test of this is to search for "xd" and see that :grinning_squiting_face: (😆) is the top and only result.

@jsumners

jsumners commented Jun 2, 2026

Copy link
Copy Markdown
Owner

I need to think about this. The idea was that Alfred would take care of filtering results (https://www.alfredapp.com/help/workflows/inputs/script-filter/#alfred-filters-results), but it looks like that checkbox has not been toggled all this time. Ticking the box has not negatively impacted the workflow for me locally.

Or maybe that checkbox got cleared so we can filter on alternative names. I'll have to research back through the issues for any references.

This commit sets alfredfiltersresults to true, enabling Alfred's fast
and smart filtering. In order to support searching by alternate names,
it also adds a match property on alfredItems, which Alfred will search
on instead of the title property, which is the default.
@shreve

shreve commented Jun 2, 2026

Copy link
Copy Markdown
Author

Oh wow that makes a lot of sense. I didn't realize that option was there 🤯

I changed the implementation to rely on Alfred instead, and added a "match" property, which lets Alfred search based on alternate names. In my testing so far, this works much faster and is pretty smart. The only downside I've found so far is that Alfred's filtering only supports prefix matching, so for example, the search "tia" only matches "tiara" and not "credentials", "croatia", "hatian", or "christian". That seems like a worthy-enough tradeoff, though.

@shreve shreve changed the title Improve search results by ranking better matches Improve search by letting Alfred filter results Jun 2, 2026
@natebeaty

Copy link
Copy Markdown

Fwiw, this seems like a big improvement in my testing. I also use your picker daily (thanks!) but the search results often baffle me and I can't find simple things by direct matches, even though I've looked up dozens of times, e.g. "old man" or "red heart" or "fingers crossed" ... often the direct match will be buried in the results. After making these tweaks, they always show first most of my tests. That said, they both fail pretty miserably for "eyes" to match 👀 even though the name is ... "eyes". I know search is hard™, but it seems like these direct matches should surface to the top.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants