DIM icon indicating copy to clipboard operation
DIM copied to clipboard

Add a `with` operator to narrow searches

Open bhollis opened this issue 4 months ago • 5 comments

I'd like to add a new operator to search called with. This operator has two operands, both of which are searches:

  • The left operand is a normal search that may contain some searches that are dependent on the set of items, e.g. is:dupe or is:statlower.
  • The right operand is a search that determines what items are considered for evaluating the left operand.

For example: is:dupe with techsec would find all items that are duplicates only considering items that match "techsec".

To do this, we'd create scoped search contexts within the search evaluation tree, and pass the pre-filtered list of items as allItems into the selectors for that context and for the filter creation functions.

If the left operand doesn't have any of the special dupe-style operators, with effectively behaves like and and we can maybe even optimize out the sub-context stuff there.

The main thing I'm not sure about is whether with is the right operator name, and whether anyone will be able to figure out how to use this without us telling them in Discord every time.

I think it should fix #9906

bhollis avatar Aug 11 '25 02:08 bhollis

with is very programmingy but not bad. Some other candidates might be "from", or "among". "Within" is pretty nice and has very clear directionality.

chainrez avatar Aug 11 '25 04:08 chainrez

Found this issue while trying to do pretty much that exact search, was surprised to see that it wasn't possible currently. I should note on the intuition side that I was surprised is:statlower didn't already respect my other filters.

Personally I think in would be a good name for this operator as proposed. E.g:

  • To find my redundant techsec armor: is:statlower in techsec
  • To find my highest power brawler set is:maxpower in exactperk:brawler

Ideally I'd love to be able to de-dupe across armor sets like this: is:statlower by perk to filter all redundant armor in one quick command. This could still be achieved with just the in/with operator as proposed (with a very long statement like (is:statlower in techsec) or (is:statlower in bushido) or ..., but it would at least be possible.

Danzibob avatar Aug 18 '25 22:08 Danzibob

in is a good option!

by would be much tougher, but maybe once the first operator is implemented, automatic grouping will seem easier.

bhollis avatar Aug 18 '25 22:08 bhollis

Note that the new dupe: search reduces the importance of this, because you can do:

  • To find my redundant techsec armor: dupe:setbonus+statlower techsec

bhollis avatar Aug 27 '25 18:08 bhollis

This would function like subqueries?

Revadike avatar Dec 11 '25 09:12 Revadike