{"id":12128,"date":"2015-08-28T10:40:43","date_gmt":"2015-08-28T14:40:43","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=12128"},"modified":"2018-04-17T14:36:59","modified_gmt":"2018-04-17T18:36:59","slug":"live-help-menu-searching-via-nsuserinterfaceitemsearching","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2015\/08\/28\/live-help-menu-searching-via-nsuserinterfaceitemsearching\/","title":{"rendered":"Live Help Menu Searching via NSUserInterfaceItemSearching"},"content":{"rendered":"<p><a href=\"http:\/\/shapeof.com\/archives\/2015\/8\/acorn_5_search_index.html\">Gus Mueller<\/a> (<a href=\"https:\/\/twitter.com\/ccgus\/status\/635961140921565184\">tweet<\/a>):<\/p>\n<blockquote cite=\"http:\/\/shapeof.com\/archives\/2015\/8\/acorn_5_search_index.html\"><p>When rendering the documentation (542MB of it, 1.22GB pre-render!), FMWrite also creates a SQLite index (1MB) of all the text content, which I then copy into Acorn&rsquo;s resources folder at build time. Acorn then ships with this SQLite file.<\/p>\n<p>You don&rsquo;t really need to build your own documentation app. But you do need an index of your documentation to ship with your app. SQLite worked great for us.<\/p>\n<p><strong>Step 2:<\/strong> Let me introduce you to <a href=\"https:\/\/developer.apple.com\/library\/mac\/documentation\/AppKit\/Reference\/NSUserInterfaceItemSearching_Protocol\/\">NSUserInterfaceItemSearching<\/a>, which is a class which shipped in 10.6 but I didn&rsquo;t notice till about six months ago.  It&rsquo;s a pretty simple protocol&mdash;you just register a class which conforms to it, and you&rsquo;re asked for entries when the user searches for something via the Help menu.<\/p>\n<\/blockquote>\n<p>Note that you don&rsquo;t <em>have<\/em> to implement your own index and conform to this protocol to get live searching in the Help menu. You get that for free if you&rsquo;re using Apple Help and have an <a href=\"https:\/\/developer.apple.com\/library\/mac\/documentation\/Darwin\/Reference\/ManPages\/man1\/hiutil.1.html\">hiutil<\/a> index. The protocol is for when you want to search the help locally but host it on your server.<\/p>","protected":false},"excerpt":{"rendered":"<p>Gus Mueller (tweet): When rendering the documentation (542MB of it, 1.22GB pre-render!), FMWrite also creates a SQLite index (1MB) of all the text content, which I then copy into Acorn&rsquo;s resources folder at build time. Acorn then ships with this SQLite file. You don&rsquo;t really need to build your own documentation app. But you do [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2018-04-17T18:37:01Z","apple_news_api_id":"d01d0eaf-0ec4-4545-81a4-d06265a42751","apple_news_api_modified_at":"2018-04-17T18:37:03Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/A0B0Orw7ERUWBpNBiZaQnUQ","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[76,1658,164,978,30,32,71,425],"class_list":["post-12128","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-acorn","tag-apple-help","tag-documentation","tag-full-text-search","tag-mac","tag-macapp","tag-programming","tag-sqlite"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/12128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=12128"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/12128\/revisions"}],"predecessor-version":[{"id":12129,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/12128\/revisions\/12129"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=12128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=12128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=12128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}