diff --git a/README.md b/README.md index 2f85791..bf0826a 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,28 @@ # Search Notes.app with Alfred +### Search titles or create a new note if none was found +

- + +

-## Usage +### Search note titles and bodies -### Search keywords +

+ +

-* **n** to search note titles (this also lets you find notes using the pattern "[folder name] [note name]") -* **nb** to include note body text in search -* **nf** to search note folder names +### Search folder names + +

+ +

### Result actions -* **enter** to open the note/folder, or create a new note if none was found -* **shift+enter** to search for your Alfred query using the Notes in-app search +* **enter** to open the note/folder or create a new note if none was found +* **shift+enter** to search for your Alfred query using the Notes in-app search * **cmd+enter** to copy the note body to the clipboard * **alt+enter** to copy a notes:// URL to the clipboard that can be opened with the included `Note Opener/Note Opener.app` @@ -23,28 +30,28 @@ If you're on macOS Catalina with Alfred 4, download the [latest version](https://github.com/sballin/alfred-search-notes-app/releases/latest/download/Search.Notes.alfredworkflow) of the workflow. -### Authorizing the binary +### Required setup The "search" binary needs to be manually authorized to run on your computer. Right-click the Search Notes workflow, click "Open in Finder", open the "search" folder, right-click the "search" binary, click "Open", and you should be all set after it runs once in Terminal. -### Older versions +### Customize -If you encounter problems or are on an older version of macOS/Alfred, try an older version like [1.4.3](https://github.com/sballin/alfred-search-notes-app/releases/tag/1.4.3). +Result ordering and title+folder search behavior can be controlled using the [environment variables](https://www.alfredapp.com/help/workflows/advanced/variables/#environment). -### Stay up to date +### Updates By default, the workflow checks Github for updates every 24 hours. This can be disabled by removing the connections to the "Check for updates" block in the workflow. -You can also be notified of new releases by watching this repo or subscribing to the Alfred forum [thread](https://www.alfredforum.com/topic/11716-search-appleicloud-notes/). +### Compile -## Customize - -Result ordering and title+folder search behavior can be controlled using the [environment variables](https://www.alfredapp.com/help/workflows/advanced/variables/#environment). +If you want to compile the binary yourself, you can go into the "search" folder and do `go build`. ## Contributors Thank you to all who have submitted pull requests, and to [drgrib](https://github.com/drgrib) for allowing me to build off the [alfred-bear](https://github.com/drgrib/alfred-bear) workflow. +I'm very new to Go, so if you see anything that can be improved, don't hesitate to submit a pull request. + ## Donate If you enjoy using this workflow, consider [donating](http://paypal.me/sbballin)! diff --git a/alfred/alfred.go b/alfred/alfred.go index 9b3d22d..566320c 100644 --- a/alfred/alfred.go +++ b/alfred/alfred.go @@ -1,3 +1,5 @@ +/* Modified from github.com/drgrib/alfred so that quicklookurl can be "null" without quotes */ + package alfred import ( diff --git a/info.plist b/info.plist index 5634224..4f6305f 100644 --- a/info.plist +++ b/info.plist @@ -671,6 +671,8 @@ or create note sortByDate 1 + variablesdontexport + version 3.0.0 webaddress diff --git a/search/main.go b/search/main.go index c1a0d0a..f9ce781 100644 --- a/search/main.go +++ b/search/main.go @@ -170,8 +170,10 @@ func (lite LiteDB) QueryThenSearch(q string, search string) ([]map[string]string if err := rows.Scan(columnPointers...); err != nil { return results, err } + // Skip adding item if note body does not contain search string val := columnPointers[len(cols)-1].(*interface{}) + // Type assertion required by bytesReader noteBodyZippedBytes, ok := (*val).([]byte) if !ok { continue