Skip to content

Commit

Permalink
Add 'supported' array to Algolia data
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlgo11 committed Nov 20, 2023
1 parent 3a153cf commit bdc7ac6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scripts/Algolia.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -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
Expand Down

0 comments on commit bdc7ac6

Please sign in to comment.