Here's an fsize: filter expression I put together with the help of ChatGPT 5.6 Sol:
Code: Select all
#[iflen:$param:#,:[define:_q=[regexreplace:[unquote:$param:],",",""]][define:_u=[lower:[regexextract:[_q:],"([a-z]+)$"]]][define:_n=[regexextract:[_q:],"^([0-9.]+)"]][define:_m=[switch:[_u:],k,1024,kb,1000,kib,1024,m,1048576,mb,1000000,mib,1048576,g,1073741824,gb,1000000000,gib,1073741824,t,1099511627776,tb,1000000000000,tib,1099511627776,b,1,1]][define:_d=[regexextract:[_q:],"\.([0-9]+)"]][define:_p=[len:[_d:]]][define:_s=[eval:[_m:]/[power:10,[_p:]]]]$size:>[eval:[_n:]*[_m:]-([_p:]==0)*[_m:]-([_p:]>0)*[_s:]/2] $size:<=[eval:[_n:]*[_m:]+([_p:]>0)*[_s:]/2]#,:#]:For example, one test file has an exact size of 3,988,632 bytes, or approximately 3895.148 KiB / 3.803856 MiB. It is displayed as 3896 KB in Everything and 3.80 MB in Windows Properties:
Code: Select all
size:3896k -> no match
fsize:3896k -> match
size:3.80m -> match
fsize:3.80m -> matchWhole-number values: fsize:3896k effectively means 3895 KiB < size <= 3896 KiB. The discrepancy occurs because Everything displays integer KB values using ceiling rounding: the file is actually about 3895.148 KiB but is displayed as 3896 KB. Native size:3896k instead searches forward from 3896 KiB, so the file falls below its range.
Decimal values: fsize:3.8m matches approximately 3.75 MiB < size <= 3.85 MiB, while fsize:3.80m matches approximately 3.795 MiB < size <= 3.805 MiB. Native size: uses a forward, floored bucket at the precision entered rather than centering the range. Trailing zeros therefore intentionally narrow both searches, but the resulting ranges are different.
Supported units: b, k, m, g, t, kb, mb, gb, tb, kib, mib, gib, tib
- No suffix means bytes.
- k/m/g/t and kib/mib/gib/tib are 1024-based.
- kb/mb/gb/tb are 1000-based.
- Commas and uppercase suffixes are supported.
- An empty fsize: is ignored.
Code: Select all
fsize:3,988,632
fsize:3896k
fsize:3.80m
fsize:5mb
fsize:5mibIs there already a cleaner built-in way to search for the displayed or rounded Size-column value, or a simpler way to write this expression?
Why not just enable size_search_ceil?
I considered enabling size_search_ceil, but I did not want to globally change the behavior of native size: searches. I still want searches such as size:1kb, size:>5m, and size:1m-10m to retain their normal semantics. So fsize: is meant to be a separate opt-in search for matching displayed sizes, with added support for explicit IEC binary units such as KiB, MiB, GiB, and TiB.
Thoughts?