build 1573 - lightweight Spotlight integration
build 1573 - lightweight Spotlight integration
Hi everybody!
Here's the next preview build with some Spotlight integration (http://filesmanager.info/forum/viewtopic.php?f=6&t=87):
http://filesmanager.info/downloads/prev ... (1573).zip
Spotlight search popup is set on ALT+CMD+F hotkey by default.
Search itself is based on kMDItemFSName, not on item's content.
Spotlight query format can be changed via config at "filePanel.spotlight.format" (no UI currently), by default this value is
"kMDItemFSName == '*#{query}*'cd" - simply searches for items with filenames containing entered search criteria (ignorant to case and diacritical marks).
Mike.
Here's the next preview build with some Spotlight integration (http://filesmanager.info/forum/viewtopic.php?f=6&t=87):
http://filesmanager.info/downloads/prev ... (1573).zip
Spotlight search popup is set on ALT+CMD+F hotkey by default.
Search itself is based on kMDItemFSName, not on item's content.
Spotlight query format can be changed via config at "filePanel.spotlight.format" (no UI currently), by default this value is
"kMDItemFSName == '*#{query}*'cd" - simply searches for items with filenames containing entered search criteria (ignorant to case and diacritical marks).
Mike.
Re: build 1573 - lightweight Spotlight integration
Hi Mike,
I've been looking forward to this, thanks for adding it so quickly. Here are some thoughts about it. The default setting
"kMDItemFSName == '*#{query}*'cd"
works fine. Same goes for other "kMDItem*" attributes I've tried (a good overview is given in http://osxnotes.net/spotlight.html). What I'm looking for is getting results from terminal command "mdfind -name ...". So I changed filePanel.spotlight.format to
"-name #{query}"
but this crashes NC instantly. Am I missing something? As you indicated, GUI-based settings would be nice.
Also, a really useful addition to this feature would be live results as-you-type. What do you think?
Best,
Sasha
I've been looking forward to this, thanks for adding it so quickly. Here are some thoughts about it. The default setting
"kMDItemFSName == '*#{query}*'cd"
works fine. Same goes for other "kMDItem*" attributes I've tried (a good overview is given in http://osxnotes.net/spotlight.html). What I'm looking for is getting results from terminal command "mdfind -name ...". So I changed filePanel.spotlight.format to
"-name #{query}"
but this crashes NC instantly. Am I missing something? As you indicated, GUI-based settings would be nice.
Also, a really useful addition to this feature would be live results as-you-type. What do you think?
Best,
Sasha
Re: build 1573 - lightweight Spotlight integration
Hi Sasha,
Oh, my bad, there was no check on query making failure
This format uses search query expressions, there's nothing here to do with command-line parameters of mdfind.
Some more info is available in Apple's docs:
https://developer.apple.com/library/mac ... ormat.html
https://developer.apple.com/library/mac ... 001694-SW1
As for fetching results as-you-type - I have serious doubts about it.
First of all - time to process the search query itself is not that small: on my QC machine w/ SSD it takes about 0.5sec (plus time to read information from filesystem). And secondly - currently I haven't figured out how integrate it into existing architecture and UI control flow without any dirty hacks and/or making some decisions I would regret later
Mike.
Oh, my bad, there was no check on query making failure
This format uses search query expressions, there's nothing here to do with command-line parameters of mdfind.
Some more info is available in Apple's docs:
https://developer.apple.com/library/mac ... ormat.html
https://developer.apple.com/library/mac ... 001694-SW1
As for fetching results as-you-type - I have serious doubts about it.
First of all - time to process the search query itself is not that small: on my QC machine w/ SSD it takes about 0.5sec (plus time to read information from filesystem). And secondly - currently I haven't figured out how integrate it into existing architecture and UI control flow without any dirty hacks and/or making some decisions I would regret later
Mike.
Re: build 1573 - lightweight Spotlight integration
Ok, I got it, thanks for clarifying.
I would like to enter multiple items into "Find with Spotlight" like "author1 author2 pdf" (w/out the quotation marks) and find filenames that contain all of the items, order irrelevant. The query would look like this:
"format": "(kMDItemFSName == '*author1*'cd) && (kMDItemFSName == '*author2*'cd) && (kMDItemFSName == '*pdf*'cd)"
That works fine with static strings. Is there a way to access space-separated substrings of #{query} in NC's config file? (Just entering "author1*author2*pdf" in NC doesn't work because the items must be in that order.) Thanks!
I would like to enter multiple items into "Find with Spotlight" like "author1 author2 pdf" (w/out the quotation marks) and find filenames that contain all of the items, order irrelevant. The query would look like this:
"format": "(kMDItemFSName == '*author1*'cd) && (kMDItemFSName == '*author2*'cd) && (kMDItemFSName == '*pdf*'cd)"
That works fine with static strings. Is there a way to access space-separated substrings of #{query} in NC's config file? (Just entering "author1*author2*pdf" in NC doesn't work because the items must be in that order.) Thanks!
Re: build 1573 - lightweight Spotlight integration
Well, I think it's possible to implement the following scheme:
- if only #{query} is used in format string - proceed as now
- if there're #{query1}, #{query2}... in format string - split entered text with spaces and use that words as query1, query2 etc
What do you think on this variant?
Anyway, IMHO such usage looks like a very specialized task, not sure if this feature would be used at all.
- if only #{query} is used in format string - proceed as now
- if there're #{query1}, #{query2}... in format string - split entered text with spaces and use that words as query1, query2 etc
What do you think on this variant?
Anyway, IMHO such usage looks like a very specialized task, not sure if this feature would be used at all.
Re: build 1573 - lightweight Spotlight integration
Just to chip in my 2 cents: I don't see much use for spotlight integration right now. Personally I'd rather see some workflow improvements and polish in the current find in files feature
Re: build 1573 - lightweight Spotlight integration
Mike,
that scheme would be very helpful to me. It would be certainly used by me a lot
- Sasha
that scheme would be very helpful to me. It would be certainly used by me a lot
- Sasha
Re: build 1573 - lightweight Spotlight integration
Alright, this seems to be fairly easy, I've played a bit with this approach, and get working stuff like below:
"format": "(kMDItemFSName == '*#{query1}*'cd) && (kMDItemFSName == '*#{query2}*'cd) && (kMDItemFSName == '*#{query3}*'cd)",
However, there's a major flaw with amount of parameters.
Currently it appears that format string can work with fixed amount of parameters only - there're is no intelligent way to "scale" such format string.
If one wants to filter filenames by, say, 5 parts - then go ahead and change the format string!
That's quite ridiculous, but any dumb scaling, like multiplying strings and concatenate them with fixed logical AND (&&), is ridiculous too - what if someone needs something different?
"format": "(kMDItemFSName == '*#{query1}*'cd) && (kMDItemFSName == '*#{query2}*'cd) && (kMDItemFSName == '*#{query3}*'cd)",
However, there's a major flaw with amount of parameters.
Currently it appears that format string can work with fixed amount of parameters only - there're is no intelligent way to "scale" such format string.
If one wants to filter filenames by, say, 5 parts - then go ahead and change the format string!
That's quite ridiculous, but any dumb scaling, like multiplying strings and concatenate them with fixed logical AND (&&), is ridiculous too - what if someone needs something different?
Re: build 1573 - lightweight Spotlight integration
You're right, the current default
"kMDItemFSName == '*#{query}*'cd"
should stay as it is. If the user can access the substrings using something like "#{query2}", that's already incredibly helpful for a lot of Spotlight magic. A more professional solution would probably involve using regular expressions, but your proposed solution is perfectly fine for me.
"kMDItemFSName == '*#{query}*'cd"
should stay as it is. If the user can access the substrings using something like "#{query2}", that's already incredibly helpful for a lot of Spotlight magic. A more professional solution would probably involve using regular expressions, but your proposed solution is perfectly fine for me.
Re: build 1573 - lightweight Spotlight integration
Ok, great, so I think this is it for Spotlight now, maybe I'll return to this feature at some point later.
However, frankly I didn't quite understand your use case - you want to stick to fixed amount of parameters (say, 3) and use only that type of queries?
Some explanation would help me a lot.
However, frankly I didn't quite understand your use case - you want to stick to fixed amount of parameters (say, 3) and use only that type of queries?
Some explanation would help me a lot.