Page 1 of 1
How to Force Quicksearch() include zero level folders?
Posted: 27 Jan 2021 14:03
by eil
I'm definitely dumb, as whatever i do i can't make Quicksearch() to make search among 0 level folders, it just skips them and goes in subs. The most irritating thing is that i could imagine that this is due to "over-smart" logic when only folders are selected(maybe those are considered as only a path markers), but even if i select some files and folders, Quicksearch() checks 0 level files and finds everything in subs, still skipping 0 level folders.
example code i was experimenting:(i specifically leave commented variants i tried too)
Code: Select all
$selItems = <get SelectedItemsPathNamesSlashed |>;
$selItems = replace($selItems, "|", ";");
//$selItems = $selItems . ";" . quicksearch("* /d", "$selItems", ";");
//$tags = quicksearch("tags:* /n /maxdepth=0", $selItems,"f") . ";" . quicksearch("tags:*", "$selItems", ";");
$tags = quicksearch("tags:* /t", "$selItems", ";");
items structure:
Code: Select all
folder1
file1
file2 - labeled = found
folder2 - labeled = !not found
folder21 - labeled = found
folder22
file221 - labeled = found
folder3 - labeled = !not found
Re: How to Force Quicksearch() include zero level folders?
Posted: 27 Jan 2021 15:19
by highend
? It's totally normal that quicksearch doesn't list the folders itself in a multi-path only scenario.
Your structure example looks at least incomplete...
Code: Select all
$selItems = <get SelectedItemsPathNamesSlashed <crlf>>;
$result = "";
foreach($selItem, $selItems, <crlf>, "e") {
$result .= $selItem . <crlf> . quicksearch(, $selItem) . <crlf>;
}
$result = formatlist($result, "e", <crlf>);
text $result;
Re: How to Force Quicksearch() include zero level folders?
Posted: 27 Jan 2021 17:28
by eil
highend wrote: ↑27 Jan 2021 15:19
? It's totally normal that quicksearch doesn't list the folders itself in a multi-path only scenario.
so as i understand i was right and there is totally no way to give qiucksearch() a list of mixed items and make it search only among those.
from user perspective it feels quite strange: there are at least 2 settings for this command(/n, /maxdepth=) that one would expect to have some influence on such situation, while they not. guess will make another wish..

Re: How to Force Quicksearch() include zero level folders?
Posted: 27 Jan 2021 17:39
by highend
Mixed items are fine, I talked about multi-path only selections...
Apart from that, the gui does the same and quicksearch() just "imitates" it...
Re: How to Force Quicksearch() include zero level folders?
Posted: 27 Jan 2021 18:19
by eil
highend wrote: ↑27 Jan 2021 17:39
Mixed items are fine, I talked about multi-path only selections...
Apart from that, the gui does the same and quicksearch() just "imitates" it...
but it's not fine, quicksearch works quite unpredictable for me..
here's structure i use for experiment with selection(all selected items are on same level)
2021-01-27_202110.png
each time same script only search pattern changed:
searching
"t" in name = 0 level included and found
Code: Select all
$selItems = <get SelectedItemsPathNamesSlashed |>;
$tags = quicksearch("*t*", "$selItems", "<crlf>");
echo $tags;
2021-01-27_202724.png
searching
"i" in name = 0 zero level included and found
Code: Select all
$selItems = <get SelectedItemsPathNamesSlashed |>;
$tags = quicksearch("*i*", "$selItems", "<crlf>");
echo $tags;
2021-01-27_202651.png
searching tagged(
tags:*) items = 0 level folders skipped
Code: Select all
$selItems = <get SelectedItemsPathNamesSlashed |>;
$tags = quicksearch("tags:*", "$selItems", "<crlf>");
echo $tags;
2021-01-27_203226.png

yet it's truly strange logic that if i select 100 folders, i can't search among them itself(0 level) as it's multi-location-search, but if i simply add 1 file to this list - 0 level folders are in search results(at least for names).
