From bdc7ac67b28c3408180c6cd30b6c10b64b329f71 Mon Sep 17 00:00:00 2001 From: Carlgo11 Date: Mon, 20 Nov 2023 23:26:38 +0100 Subject: [PATCH] Add 'supported' array to Algolia data --- scripts/Algolia.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/Algolia.rb b/scripts/Algolia.rb index fcb9414..ee82356 100755 --- a/scripts/Algolia.rb +++ b/scripts/Algolia.rb @@ -9,7 +9,7 @@ ALGOLIA_API_KEY = ENV['ALGOLIA_API_KEY'] ALGOLIA_INDEX_NAME = ENV['ALGOLIA_INDEX_NAME'] -excludes = %w[notes documentation recovery] +excludes = %w[notes documentation recovery passwordless mfa] client = Algolia::Search::Client.create(ALGOLIA_APP_ID, ALGOLIA_API_KEY) index = client.init_index(ALGOLIA_INDEX_NAME) updates = [] @@ -27,6 +27,14 @@ data.merge!({ 'name' => name, 'objectID' => File.basename(entry, '.*') }) # Rename keys data['category'] = data.delete 'categories' + + %w[mfa passwordless].each do |key| + next unless data.key?(key) + + data['supported'] ||= [] + data['supported'] << key + end + # Remove keys that shouldn't be searchable data.reject! { |k, _| excludes.include? k } updates.push data