Cidan / BetterBags

A total replacement AddOn for World of Warcraft bag frames, inspired by AdiBags.
MIT License
86 stars 37 forks source link

[Feature]: When number entered in search bar, interpret as "level=number"; when >number entered, interpret as "level>number" #521

Open RaphanW opened 1 month ago

RaphanW commented 1 month ago

Describe the feature

I'd love it if search work as described in the title.

I've never searched for a three digit number, especially, except for searching for gear by ilvl.

So for example, these queries:

"<200" should be read as "level<200" "486" should be read as "level=486" "486 or 489" read as "level=486 or level=489" ">400 and <500" should be read as "level>400 and level<500"

If you really wanted, you could interpret the equals with an or, such as "200" read as "level=200 or 200" For the > and < operations, no one is ever searching for the text "<200" in the name of the item. They are searching for ilvl.

Cheers.

Describe the implementation

A bit of code parsing the search bar, that if it is a number with < or > in front of it, and nothing else, it means "level>number"

If it's just a number, it means "level=number or number"

Cidan commented 1 month ago

I'm on the fence about this one. Let me think about it and I'll get back to you!

zeptognome commented 1 month ago

They are searching for ilvl.

Probably, but I don't think it can be an exclusive search. There are a good number of items with numbers in the name. Copilot found a few - there are other 3 digit fish as well.

https://www.wowhead.com/item=74853/100-year-soy-sauce https://www.wowhead.com/item=160317/v-300-serial-plate https://www.wowhead.com/item=13917/103-pound-mightfish#

plus a ton of Darkmoon cards and other items with smaller numbers

RaphanW commented 1 month ago

As an alternate, interpreting

=300 as level=300.

Or even having "l" as an alias for "level", such as l=300 as level=300 l>450 and l<500 as level>450 and level<500

Cidan commented 1 month ago

How about the ability to define your own aliases?

RaphanW commented 1 month ago

That would work too.

Are you about to tell me that's already a feature? 😊

Cidan commented 1 month ago

Hehe, no, I mean you could edit like, 1 line in a lua file to add it, but it's not an option yet. Will work on it!

RaphanW commented 1 month ago

Fair enough. Thanks for the consideration.

I think most use cases would benefit from the original suggestion, but if you don't like that or adding ability for aliases is a lot less work, I am all for it!


offtopic: I have tried editing lua files before for small items like this, but then when I update the addons, my edits are gone, and I don't know how to elegantly keep track of this or keep things updated with small edits over a number of addons.

I don't have the programming/lua experience to code a alias-namer. Is (https://wowpedia.fandom.com/wiki/Create_a_WoW_AddOn_in_15_Minutes) the most relevant starting-off point? I don't imagine you'd want a pull request hard-coding 'l' as an alias for 'level.'