Rewriting Query Parameters to the Bright API

Note - this option is only available to users who are running Bright Server in a private or self-hosted environment. For more information on upgrading your environment please contact Us

Bright Private Servers permit query rewriting via a "Hooks" model:

  require 'wordpress_hooks' # WordPress style actions and filters.

  rewrite_hook = WordPressHooks.add_filter(name: 'bright_api_index_parameters',
    func: Proc.new { |p|
      if p[:params]["custom"] && p[:params]["custom"].match(/something/i)
        p[:params]["custom_re"] = 'something'
        p[:params].delete("custom")
        Rails.logger.info('Rewrote parameters for something from custom to custom_re')
      end
      p
    })

In the example above, queries on the exact match of custom field that match "something" are re-written to use the Bright regular expression matcher.

Need a complex customization like this? Contact us