SC Quicksearch - list search misses folders?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

SC Quicksearch - list search misses folders?

Post by Papoulka »

I need quicksearch() to search a list of folders described in "ListToSearch.txt". Eg. I want to find all that have "mata" in their name. BTW I must use quicksearch because I want to add fuzziness after I get the basics working.

My code is:

Code: Select all

$list = readfile("C:\Temp\ListToSearch.txt");
  text quicksearch("mata", $list);
or from the address bar:

Code: Select all

::text quicksearch("mata", readfile("C:\Temp\ListToSearch.txt"));
If "ListToSearch.txt" contains the name of a text file:
  • c:\temp\mata.txt
the result as expected is "c:\temp\mata.txt".

But if "ListToSearch.txt" contains only the name of a folder:
  • c:\temp\mata

the result is empty - not as expected.
Quicksearch does not find the folder "mata" in the list.

I've tried everything I can think of. Any ideas?

highend
Posts: 14994
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: SC Quicksearch - list search misses folders?

Post by highend »

Looks like a bug when using Search-In-List.
When you add a second item to the ListToSearch.txt file that is not that folder, the "mata" folder is found..
One of my scripts helped you out? Please donate via Paypal

Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

Re: SC Quicksearch - list search misses folders?

Post by Papoulka »

Thanks for confirming that, highend. I wasn't sure it was a bug but ran out of ideas.

Following your observation - if the search list file contains a filename in addition to the folder names, QS succeeds. The problem seems limited to search lists comprising only folder names - which of course is what I am trying to use.

Until this is fixed, I may be able to work around it by adding a dummy filename.

admin
Site Admin
Posts: 66652
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: SC Quicksearch - list search misses folders?

Post by admin »

Not a bug but works as advertised: Folders in Search-In-List are recursed just as in a multi-location search. They are not checked against the search pattern.

Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

Re: SC Quicksearch - list search misses folders?

Post by Papoulka »

OK, now I understand. I can suggest a small improvement in the Help for SIL. It currently says:
This list can contain files (they are directly checked against the search filters) and folders (they are recursed like in a normal (multi-)location search).
Add a following sentence: "Note: this means it can only search for files; not for folders".

I got confused because:
(a) I wanted to believe that SIL would find folders too ["The list can contain ... folders"].
(b) Most searches in XY can find files or folders.
(c) The rest of the text often refers to finding "items", which in XY usually means files, folders etc.
(d) It seemed like SIL *would* find folders, if there was at least one filename in the list.

This is rather a special case, so it could use a very clear note.

admin
Site Admin
Posts: 66652
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: SC Quicksearch - list search misses folders?

Post by admin »

IMO the current description is sufficient. (And your suggestion "Note: this means it can only search for files; not for folders" is wrong: it can find folders, if they are within the passed search locations.)

Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

Re: SC Quicksearch - list search misses folders?

Post by Papoulka »

Then please give an example of how to use quicksearch() to find folders but no files. Adding it to the Examples list in the Help would also be useful, as it is not easy to figure out.

Thanks

eil
Posts: 1888
Joined: 13 Jan 2011 19:44

Re: SC Quicksearch - list search misses folders?

Post by eil »

@Papoulka seems like you're talking about same thing i asked here.
to solve same problem i had to make an additional brick of code to check is passed item is a folder and check them one by one. files and the insides of these folders will be handled by SIL, but true - first level folders are "skipped". :(
Win 7 SP1 x64 100% 1366x768|1900x1080

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: SC Quicksearch - list search misses folders?

Post by bdeshi »

Papoulka wrote:Then please give an example of how to use quicksearch() to find folders but no files
it's basic really; just use the folders-only flag:

Code: Select all

text quicksearch('* /d');
which will find all folders in current location. No "brick of code" required! :kidding:

Read more about quicksearch: ::rtfm 'idh_quicknamesearch.htm';
Adding more examples to quicksearch()'s description is a bit redundant, since a link to the syntax is already provided there.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

Re: SC Quicksearch - list search misses folders?

Post by Papoulka »

@Sammay - does that work for you in SIL? That's the question at hand.

@eil - You're right... your thread was on the same issue. But from the title I didn't realize it.
Last edited by Papoulka on 16 Nov 2015 15:45, edited 1 time in total.

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: SC Quicksearch - list search misses folders?

Post by bdeshi »

uh, yes.

Code: Select all

text quicksearch('* /nd', listfolder(,,,';'));
lists folders in current list.

Regarding your original issue that quicksearch('pattern', 'a folder') doesn't match, it's because a single source folder is taken as the location to search in, so the folder itself is excluded (because it has become the parent location)
However, when the source is one or more items, [quicksearch('pattern', 'a folder;another item')] they are considered the items to search within, so any folder in the source matches.(the source param has become the (virtual) parent location)

(Don might want to explain this fact better in the docs.)

edited.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

eil
Posts: 1888
Joined: 13 Jan 2011 19:44

Re: SC Quicksearch - list search misses folders?

Post by eil »

SammaySarkar wrote:it's basic really; just use the folders-only flag:

Code: Select all

text quicksearch('* /d');
which will find all folders in current location. No "brick of code" required! :kidding:
not really.) it's already SIL1(as usual) + SIL2(with flag for folders) + combine results in paper folder = because i want script to be universal and find everything without case if there is one folder in pattern or more. :P
SammaySarkar wrote:Regarding your original issue that quicksearch('pattern', 'a folder') doesn't match, it's because a single source folder is taken as the location to search in, so the folder itself is excluded (because it has become the parent location)
that's the point of misunderstanding: when you select just one folder its obvious to become "virtual", but when you selected(stated) i big list of items you don't expect anything to skip.
Win 7 SP1 x64 100% 1366x768|1900x1080

admin
Site Admin
Posts: 66652
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: SC Quicksearch - list search misses folders?

Post by admin »

Yes, I see that point. But changing this behavior would mean to break old code.

I will add a new switch to this effect: Check the folder(s) passed as search location against the search criteria. (Note that in case of a resursive search, a folder will also be recursed if it does NOT match the pattern. Okay?)

Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

Re: SC Quicksearch - list search misses folders?

Post by Papoulka »

Good idea.

eil
Posts: 1888
Joined: 13 Jan 2011 19:44

Re: SC Quicksearch - list search misses folders?

Post by eil »

admin wrote: (Note that in case of a resursive search, a folder will also be recursed if it does NOT match the pattern. Okay?)
if this means <i'm using SIL on 15 files and 1(or 3) folders and both, folders and their subs, are checked> i'm both hands up to it.!
Win 7 SP1 x64 100% 1366x768|1900x1080

Post Reply