Jump to content

Folder Search Not Working?


Recommended Posts

I have tried everything, and can't seem to figure this out. I've done all the troubleshooting steps for Alfred as well as rebuilt my Spotlight indexes, etc. File/folder search still works with native Alfred find and open commands, but I can't get any file/folder results to work with any workflows. The files/folders are found in Spotlight, so I don't think it's a Spotlight indexing issue.

 

Here is the workflow I am trying to use, but none of them work, including the "Simple Folder Search" workflow I downloaded from your site.

 

https://s3.amazonaws.com/graftechnology/temp/alfred-workflow-code.alfredworkflow

 

Finally, this Mac is fairly new and was restored using a Time Machine backup. Not sure if that matters, but wanted to mention it.

 

Thanks for any help you can give!

Link to comment

@jacobgraf Could you please share at least a few outputs for relevant files in the File Troubleshooting tool? I've tried the workflow and it works as expected, returning folders within the ~/Sites/ folder.

 

If you've just set up your Mac using a Time Machine backup, it's not unheard of to have issues with search until the index has been rebuilt, even if Spotlight appears to be returning results.

 

The next best step would be to fully rebuild your Mac, following step 6 here:

https://www.alfredapp.com/help/troubleshooting/indexing/

 

Let us know how you get on.

Link to comment

@Vero unfortunately, the rebuild didn't work. 😔

 

Here is the output from the ~/Sites troubleshooting...

 

Starting Diagnostics...

File: 'Sites'
Path: '/Users/jacobgraf'

-----------------------------------------------------------

Check file cache database...

File cache integrity is ok

-----------------------------------------------------------

Check if file is readable...

Alfred has permissions to read this file.

Unix Permissions: 493
Underlying Type: NSFileTypeDirectory
Extended Attributes: (
    "com.apple.provenance"
)

-----------------------------------------------------------

Check if volume '/' is indexed by macOS...

Indexing is enabled on this drive

-----------------------------------------------------------

Check direct file metadata...

Direct metadata available

Display Name: Sites
 Other Names: Sites
Content Type: public.folder
   Last Used: 2023-12-12 15:56:34 +0000

-----------------------------------------------------------

Check mdls file metadata...

Metadata contains required items

_kMDItemDisplayNameWithExtensions  = "Sites"
kMDItemAlternateNames              = (
    Sites
)
kMDItemContentCreationDate         = 2021-06-08 19:54:04 +0000
kMDItemContentCreationDate_Ranking = 2023-10-27 00:00:00 +0000
kMDItemContentModificationDate     = 2023-12-12 15:34:52 +0000
kMDItemContentType                 = "public.folder"
kMDItemContentTypeTree             = (
    "public.folder",
    "public.directory",
    "public.item"
)
kMDItemDateAdded                   = 2023-10-27 23:09:37 +0000
kMDItemDisplayName                 = "Sites"
kMDItemDocumentIdentifier          = 0
kMDItemFSContentChangeDate         = 2023-12-12 15:34:52 +0000
kMDItemFSCreationDate              = 2021-06-08 19:54:04 +0000
kMDItemFSCreatorCode               = ""
kMDItemFSFinderFlags               = 0
kMDItemFSHasCustomIcon             = (null)
kMDItemFSInvisible                 = 0
kMDItemFSIsExtensionHidden         = 0
kMDItemFSIsStationery              = (null)
kMDItemFSLabel                     = 0
kMDItemFSName                      = "Sites"
kMDItemFSNodeCount                 = 33
kMDItemFSOwnerGroupID              = 20
kMDItemFSOwnerUserID               = 502
kMDItemFSSize                      = (null)
kMDItemFSTypeCode                  = ""
kMDItemInterestingDate_Ranking     = 2023-12-12 00:00:00 +0000
kMDItemKind                        = "Folder"
kMDItemLastUsedDate                = 2023-12-12 15:56:34 +0000
kMDItemLastUsedDate_Ranking        = 2023-12-12 00:00:00 +0000
kMDItemUseCount                    = 10
kMDItemUsedDates                   = (
    "2023-10-31 05:00:00 +0000",
    "2023-11-21 06:00:00 +0000",
    "2023-11-30 06:00:00 +0000",
    "2023-12-12 06:00:00 +0000"
)

-----------------------------------------------------------

Check file is in search scope...

File exists within Alfred's default search scope

-----------------------------------------------------------

Check MDQuery file search...

macOS returned a match for this file in your search scope.

File Search Results for search scope (
    "[22] /System/Volumes/Data/Users/jacobgraf/Sites"
)

File Search Results for ~/ (
)

File Search Results for / (
    "[22] /System/Volumes/Data/Users/jacobgraf/Sites"
)

-----------------------------------------------------------

Troubleshooting passed
 

Link to comment

@Jacob Graf Could you please drag a folder that is within your search scope of ~/Sites/ rather than the Sites folder itself as it'll provide more useful information?

 

Can you also please let me know exactly what you're typing into Alfred? Screenshots could be useful here, so that I can see exactly what you're doing.

 

Is file search in general working for you? E.g. If you type the "open" keyword (or press the spacebar) followed by the name of one of your folders within ~/Sites/, are these folders found?

 

Finally, have you granted Alfred Full Disk Access?

https://www.alfredapp.com/help/getting-started/permissions/#integration

Link to comment

@Vero Here is a short video trying to use it. You'll notice it goes to a Google search right away. Not sure. It's like it's not using the keyword and space variable properly. e.g. `code foldername`.

 

https://cln.sh/QLdmcx9Mwm4jFbCH747M

 

Also, here is the troubleshooting info from a folder within the ~/Sites directory...

 

Starting Diagnostics...

File: 'maizzle'
Path: '/Users/jacobgraf/Sites'

-----------------------------------------------------------

Check file cache database...

File cache integrity is ok

-----------------------------------------------------------

Check if file is readable...

Alfred has permissions to read this file.

Unix Permissions: 509
Underlying Type: NSFileTypeDirectory
Extended Attributes: (
)

-----------------------------------------------------------

Check if volume '/' is indexed by macOS...

Indexing is enabled on this drive

-----------------------------------------------------------

Check direct file metadata...

Direct metadata available

Display Name: maizzle
 Other Names: 
Content Type: public.folder
   Last Used: 

-----------------------------------------------------------

Check mdls file metadata...

Metadata contains required items

_kMDItemDisplayNameWithExtensions  = "maizzle"
kMDItemContentCreationDate         = 2022-09-22 13:46:20 +0000
kMDItemContentCreationDate_Ranking = 2023-10-27 00:00:00 +0000
kMDItemContentModificationDate     = 2023-09-10 19:27:09 +0000
kMDItemContentType                 = "public.folder"
kMDItemContentTypeTree             = (
    "public.folder",
    "public.directory",
    "public.item"
)
kMDItemDateAdded                   = 2023-10-27 22:59:05 +0000
kMDItemDisplayName                 = "maizzle"
kMDItemDocumentIdentifier          = 0
kMDItemFSContentChangeDate         = 2023-09-10 19:27:09 +0000
kMDItemFSCreationDate              = 2022-09-22 13:46:20 +0000
kMDItemFSCreatorCode               = ""
kMDItemFSFinderFlags               = 0
kMDItemFSHasCustomIcon             = (null)
kMDItemFSInvisible                 = 0
kMDItemFSIsExtensionHidden         = 0
kMDItemFSIsStationery              = (null)
kMDItemFSLabel                     = 0
kMDItemFSName                      = "maizzle"
kMDItemFSNodeCount                 = 16
kMDItemFSOwnerGroupID              = 20
kMDItemFSOwnerUserID               = 502
kMDItemFSSize                      = (null)
kMDItemFSTypeCode                  = ""
kMDItemInterestingDate_Ranking     = 2023-09-10 00:00:00 +0000
kMDItemKind                        = "Folder"

-----------------------------------------------------------

Check file is in search scope...

File exists within Alfred's default search scope

-----------------------------------------------------------

Check MDQuery file search...

macOS returned a match for this file in your search scope.

File Search Results for search scope (
    "[1] /System/Volumes/Data/Users/jacobgraf/Sites/maizzle"
)

File Search Results for ~/ (
)

File Search Results for / (
    "[1] /System/Volumes/Data/Users/jacobgraf/Sites/maizzle"
)

-----------------------------------------------------------

Troubleshooting passed

Link to comment

@Jacob Graf I can indeed see that it's not returning the expected results. As mentioned earlier, I've tried your workflow and have no issues on either my own Mac or our test Mac.

 

My suspicions are still on the likelihood that a migration from Time Machine has caused underlying issues which are being exhibited in Alfred but caused by macOS.

 

If you search for those folders using Alfred's file search (i.e. "[spacebar]maizzle"), do you see the results?

 

I would recommend temporarily creating a new user account on your Mac, populating the ~/Sites/ folder with a few things, then searching using both the spacebar shortcut and your workflow to see if you're seeing results. It will help establish whether the issue is specific to your primary profile, which I think is likely, or a broader issue on your Mac.

 

Let me know how you get on.

Link to comment

@Jacob Graf Your workflow is working as expected for me.

 

To try narrowing down which aspect of indexing isn't working by fettling with your File Filter to see if you can ascertain behaviour changes.

 

For example, try first removing the public.folder from the types, and see if it finds any file types in ~/Sites. If not, try changing the scope to / instead of ~/Sites and adding back public.folder, then seeing if any folders are found.

 

Let me know how you get on.

 

Cheers,

Andrew

Link to comment

@Andrew Good ideas! So I removed the folder filter and got the same results. I then changed the scope to / and that worked! I set it back to ~/Sites and it was once again broken.

 

During this process, I did find something interesting! If I type an S in the search, it shows me the ~/Sites folder (https://cln.sh/MRTJP494ZHhd2Whz5qTC)

 

This tells me that the scope is searching the parent ~/Sites, but it doesn't appear to be searching WITHIN the ~/Sites folder.

 

When I had the scope set to /, I was able to find folders within the ~/Sites directory, so I know they at least live within the index.

 

Any ideas where to go next here?

Link to comment

@Jacob Graf If you set it to a different folder in your home folder such as ~/Downloads, does it work then? If not, if you create a new folder in your home folder, add in some files, set it to that folder, does it work?

 

It could be something whacky like a some index corruption or a filesystem node is borked where ~/Sites isn't _actually_ in that location, so setting the scope to that folder is breaking. I'm trying to ascertain if other folders work.

Link to comment

@Andrew Nope. If I change to ~/Downloads, it does the same thing. I can't get any results for anything within the folders, but if I type `code d` I see ~/Downloads as a search result

 

Also, I created a brand new folder in ~ and same thing. Can't see anything within the folder, but if I type `code t` it shows me ~/Test Folder as a search result.

 

So weird!

Link to comment

@Jacob Graf The folder set as scope will always be found as Alfred internally returns this result manually (the macOS metadata query doesn't only returns results inside the scope folders), which is why you're seeing e.g. code t return ~/Test Folder.

 

Just to double check - did you reindex including deleting the .Spotlight-V100 folder as Vero suggested?

Link to comment

@Jacob Graf I would still recommend creating a new user profile, which should only take a few minutes, activating your Powerpack and testing your workflow there with newly created workflows. This will help establish whether there's an issue with the profile data that was imported from your Time Machine, or agnostic to a new or old profile.

 

Based on our experience with past versions of macOS where community members used Time Machine and Migration Assistant to transfer data across, we've seen how hangups from previous installs can be carried across. This has an impact on much more than just Alfred's search - though it tends to be the first thing you spot. This can usually be cleared with a deep reindex but it seems that for a small number of users, it could only be sorted with a fresh install (or fresh user account).

 

 

Link to comment

I encountered a similar issue almost at the same time last week using the same workflow. I have had this workflow on my Alfred (current v. 4.8) for years and never had any issues until last week.

 

The only folder listed in my "Search Scope" was "~" (preceded by a folder icon). I removed that folder so that there are no folders in my search scope (the text below the scope table says if it the search scope table is empty it will use Alfred's default search scope). The search feature began working again.

 

Not sure if that is related to the same issue that you are experiencing. You mentioned above:

 

Quote

"I then changed the scope to / and that worked! I set it back to ~/Sites and it was once again broken.

 

Wondering if the "~" is creating issues?

 

Just a thought...

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...