willli Posted March 8, 2019 Share Posted March 8, 2019 Is it possible to search files by name and content at the same time like spotlight do? Link to comment
deanishe Posted March 8, 2019 Share Posted March 8, 2019 You can configure a File Filter to search both name and content. But AFAIK, it's not actually possible to specify fields in your query (e.g. name:Activity.java Hat) like you can in Finder. Link to comment
fjuniorr Posted March 9, 2019 Share Posted March 9, 2019 I'm trying to configure a file filter workflow to search both in the filename and it's content. However I don't seen to be getting the correct results. I have a markdown file named "stats - moments.md" with the string "=todo" inside it. When I search for either "stats" or "=todo", I got the expected results. However, when I search for "stats =todo" I don't get any results back. Is this the intended behaviour? I've posted what I hope is a reproducible example on github with the search scope set to `~/afred-reprex`. Link to comment
deanishe Posted March 11, 2019 Share Posted March 11, 2019 (edited) Hi @fjuniorr, welcome to the forum. Great description of your issue. On 3/9/2019 at 11:33 PM, fjuniorr said: Is this the intended behaviour? Unfortunately, yes. From your screenshot: Quote Note that {query} values are OR'ed together, string constant values are AND'ed together. Edited March 11, 2019 by deanishe Link to comment
fjuniorr Posted March 14, 2019 Share Posted March 14, 2019 Thank you for the clarification. Any ideas on how can I achieve this behaviour with some Alfred functionality? Link to comment
deanishe Posted March 14, 2019 Share Posted March 14, 2019 Sorry, don't know. Perhaps @Vero knows if it's somehow possible. Link to comment
Vero Posted March 14, 2019 Share Posted March 14, 2019 @deanishe @fjuniorr Ello! By default, what's happening is that both words "stats" and "=todo" are being searched for in both fields; You don't get a result because both words aren't found in the title and both words aren't found in the content. Here's a workflow that allows you to search by entering part of the title, then some content to return results. Here's the download link: https://www.dropbox.com/s/6yaqeg8koglpxae/Search File Name then Content.alfredworkflow?dl=0 Taking a look at this example, you would type the keyword "fname" followed by the file name, hit return then enter some of the content to see your results returned in-line. You'll notice the Metadata fields are empty in the file filter; The JSON object is used to dynamically set these based on your input from the first keyword. It's not possible to currently put variables into the File Filter's metadata fields, but that's something we're aware of and is on our list of considerations Let me know how you get on. Cheers, Vero Link to comment
fjuniorr Posted March 15, 2019 Share Posted March 15, 2019 Thank you very much for this workflow! The problem that still remains for my use case is that I don't know in advance where the words will appear (ie. it might be the case that both words only occur in the file content, instead of "stats" in the filename and "=todo" in the file content) and therefore can't use this type of dynamic filter. But again, thanks for the help and attention. Regards, Link to comment
llityslife Posted February 6, 2021 Share Posted February 6, 2021 On 3/15/2019 at 2:47 AM, Vero said: @deanishe @fjuniorr Ello! By default, what's happening is that both words "stats" and "=todo" are being searched for in both fields; You don't get a result because both words aren't found in the title and both words aren't found in the content. Here's a workflow that allows you to search by entering part of the title, then some content to return results. Here's the download link: https://www.dropbox.com/s/6yaqeg8koglpxae/Search File Name then Content.alfredworkflow?dl=0 Taking a look at this example, you would type the keyword "fname" followed by the file name, hit return then enter some of the content to see your results returned in-line. You'll notice the Metadata fields are empty in the file filter; The JSON object is used to dynamically set these based on your input from the first keyword. It's not possible to currently put variables into the File Filter's metadata fields, but that's something we're aware of and is on our list of considerations Let me know how you get on. Cheers, Vero There any solution for this function? First search the file, then search the file content. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now