lib/redi_search_rails.rb
def ft_search keyword:, offset: 0, num: 10, filter: {}
      if filter[:numeric_field].blank?
        results = REDI_SEARCH.call('FT.SEARCH', @index_name, keyword.strip,
          'LIMIT', offset, num)
      else
        results = REDI_SEARCH.call('FT.SEARCH', @index_name, keyword.strip,
          'LIMIT', offset, num,
          'FILTER', filter[:numeric_field], filter[:min], filter[:max]
        )
      end
      #'NOCONTENT', 'VERBATIM',  'WITHSCORES', 'NOSTOPWORDS', 'WITHPAYLOADS',
      #'INKEYS', 'INFIELDS', 'SLOP', 'LANGUAGE', 'EXPANDER', 'SCORER', 'PAYLOAD', 'SORTBY'
      return results
    rescue Exception => e
      Rails.logger.error e if defined? Rails
      return e.message
    end
def ft_search keyword:, offset: 0, num: 10, filter: {}
      if filter[:numeric_field].blank?
        results = REDI_SEARCH.call('FT.SEARCH', @index_name, keyword.strip,
          'LIMIT', offset, num)
      else
        results = REDI_SEARCH.call('FT.SEARCH', @index_name, keyword.strip,
          'LIMIT', offset, num,
          'FILTER', filter[:numeric_field], filter[:min], filter[:max]
        )
      end
      #'NOCONTENT', 'VERBATIM',  'WITHSCORES', 'NOSTOPWORDS', 'WITHPAYLOADS',
      #'INKEYS', 'INFIELDS', 'SLOP', 'LANGUAGE', 'EXPANDER', 'SCORER', 'PAYLOAD', 'SORTBY'
      return results
    rescue Exception => e
      Rails.logger.error e if defined? Rails
      return e.message
    end
def ft_search keyword : , offset : 0 , num : 10 , filter : { } if filter [ :numeric_field ] . blank? results = REDI_SEARCH . call ( 'FT.SEARCH' , @index_name , keyword . strip , 'LIMIT' , offset , num ) else results = REDI_SEARCH . call ( 'FT.SEARCH' , @index_name , keyword . strip , 'LIMIT' , offset , num , 'FILTER' , filter [ :numeric_field ] , filter [ :min ] , filter [ :max ] ) end #'NOCONTENT', 'VERBATIM',  'WITHSCORES', 'NOSTOPWORDS', 'WITHPAYLOADS', #'INKEYS', 'INFIELDS', 'SLOP', 'LANGUAGE', 'EXPANDER', 'SCORER', 'PAYLOAD', 'SORTBY' return results rescue Exception => e Rails . logger . error e if defined? Rails return e . message end
search the index for specific keyword(s)

 @param keyword [String]  'some keyword'
 @param offset [Integer]   default 0
 @param keyword [Integer]  default 10
 @return [Array]   [1, "gid://application_name/User/unique_id", ["name", "Bob", "age", "100"]]
 @raise [RuntimeError]
search the index for specific keyword ( s )