userstyles-world / userstyles.world

⭐ Website to browse and share UserCSS userstyles. A modern replacement for UserStyles.org made by the userstyles community.
https://userstyles.world
GNU Affero General Public License v3.0
324 stars 15 forks source link

searching hostnames #87

Closed Procyon-b closed 11 months ago

Procyon-b commented 3 years ago

Searching for a hostname displays mixed results.

If you search for userstyles.world, the first 3 results are for userstyles.world (in name), and the rest are either global styles, or styles that have @namespace userstyles.world , or even have no mention of userstyles.world in the source code (eg. https://userstyles.world/style/207/jvc-dark-red-x-lavydavant).

If now I search for imdb.com, nothing is shown. Searching for imdb works (in name). imdb.com is part of the @-moz-document in a regexp().

I'm sure it works as expected, but as a user standpoint it could be more flexible if you offer the option to select where to search: targeted hostname(s), meta-data (excluding @namespace), source code, description.

Gusted commented 3 years ago

If you search for userstyles.world, the first 3 results are for userstyles.world (in name),

That seems about right as names do have the priority while creating the "search ranking".

and the rest are either global styles, or styles that have @namespace userstyles.world

Hmm I do not remember that we rank them based on source code and hopefully don't as that will tank the search performance by a lot as each individual word needs to be ranked and later on compared against and we have styles that are over 100k characters.

We're currently ranking the styles on 4 things: https://github.com/userstyles-world/userstyles.world/blob/358076b7f451f236b9c33d2b03a405ab576a2fce/search/mappings.go#L18-L21

Descriptions is currently being a major thing in why certain styles show up in the search as a lot of them seems to mention userstyles.world one way or another. But their seems to be a little fault tolerance by our fuzzy-searching whereby variations of userstyles.world still count in the ranking but seems to be expected behavior from blevesearch(our current search library)

If now I search for imdb.com, nothing is shown. Searching for imdb works (in name). imdb.com is part of the @-moz-document in a regexp().

Hmm we could add the category into the mappings CC @vednoc But I think this is better to combine with #6 as a whole as it will closely relate with each other.

targeted hostname(s), meta-data (excluding @namespace), source code, description.

Hostnames should be done in pair of #6 as that includes normalizing categories. Metadata seems intresting but we should only allow a select few metadata. Source code is personally a big-no, as I'm currently pretty happy in can do much search under a ms but I don't like to see that number rise to a second or 2. Description can currently be searched on.

Regards, Gusted

Procyon-b commented 3 years ago

Source code is personally a big-no,

In fact while writing I was thinking more about the @-moz-document than anything else. But since I added "hostnames" I should have remove "source"

Gusted commented 3 years ago

In fact while writing I was thinking more about the @-moz-document than anything else. But since I added "hostnames" I should have remove "source"

Styles should have a matching category according to their moz-document, if they don't have a correct category we might need to remove them, I'm still unsure about them as it will just now fuck up stylus inline search. So this all should be throwed together into adding category's.

vednoc commented 3 years ago

Hmm we could add the category into the mappings

That's the plan.

Not sure how you dug up #6 since it comes from the time when USw was powered by Hugo. That implementation was super simple (thanks to Hugo's machinery), but now that we have to normalize categories and deal with potential garbage and edge-cases, it's...not as simple.

Gusted commented 3 years ago

Woops I thought we had a open issue about it, but I meant to link: https://github.com/userstyles-world/userstyles.world/projects/1#card-66456681