Skip to content

Commit

Permalink
Use different normalization settings for different BSPs
Browse files Browse the repository at this point in the history
  • Loading branch information
caiosba committed Aug 21, 2024
1 parent 3534a02 commit 27b9977
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/models/concerns/smooch_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,12 @@ def get_search_results(uid, message, team_id, language)
end

def normalized_query_hash(type, query, team_ids, after, feed_id, language)
normalized_query = query.downcase.chomp.strip unless query.nil?
normalized_query = nil
if RequestStore.store[:smooch_bot_provider] == 'CAPI'
normalized_query = query.to_s.downcase.chomp.strip.truncate(4096)
elsif RequestStore.store[:smooch_bot_provider] == 'SMOOCH'
normalized_query = query.to_s.downcase.chomp.strip.truncate(1024)
end
Digest::MD5.hexdigest([type.to_s, normalized_query, [team_ids].flatten.join(','), after.to_s, feed_id.to_i, language.to_s].join(':'))
end

Expand Down

0 comments on commit 27b9977

Please sign in to comment.