antfu-collective / icones

⚡️ Icon Explorer with Instant searching, powered by Iconify
https://icones.js.org
MIT License
4.97k stars 242 forks source link

Search syntax documentation #131

Open kidonng opened 1 year ago

kidonng commented 1 year ago

Clear and concise description of the problem

85 added advanced search syntax powered by fzf, but it is not documented anywhere, thus probably little-known.

With recent updates, searching icons (especially all icons) becomes less intuitive:

image

To get results comparable to the official Iconify website, one needs to use special syntax like 'heart 'fire:

image

Suggested solution

Ideally there should be a section/page mentioning how you can use advanced syntax to narrow search results.

Alternative

No response

Additional context

No response

Validations

antfu commented 1 year ago

Yeah sure, PR welcome

sqwishy commented 1 year ago

Wow this would be great. I'm glad I saw this issue. The current search is ridiculous.

Searching Solar for "trash" gives you bandages, dumbbells, underwear, phones, bedside tables, lots of arrows, a ladle? and a bunch of other things that don't make sense.

If you search All for "add bullet" there's a bunch of arrows, people playing basketball ... 90% of these results don't seem related to the query at all. It's wild.

Edit: It looks like if you search All collections for 'table it matches everything from the Tabler collection because those icon names begin with the "tabler:" prefix? (Can get away with searching table$ or 'table: instead...)

leeoniya commented 1 year ago

might i suggest switching from fzf to something much faster and much less :exploding_head: ?

https://github.com/leeoniya/uFuzzy#a-biased-appraisal-of-similar-work

vs fzf-for-js: https://leeoniya.github.io/uFuzzy/demos/compare.html?libs=uFuzzy,fzf-for-js&search=super%20ma

(happy to help out if interested)

EDIT: out of curiosity, i created a full list of all ~205k current icons and aliases from @iconify/json [1]: icons.zip. you can drag-drop this into the yellow box of the demo link above. e.g. with typo tolerance and out-of-order terms:

image

[1] https://www.npmjs.com/package/@iconify/json

cyanxxx commented 3 months ago

When I am typing the "cat", I hope the cat can priority display. Can it add the sort function to rearrange the search result? I found Fzf can take tiebreakers: [ byLengthAsc ] to decide sort order.

cat