code: def search(self, rtype, **kwargs):
          
  
          model = rtype_to_model(rtype)
          param = {}
          pages = self.pages_query(kwargs.get('pages'))
          sorts = self.sorts_query(kwargs.get(
              'sorts', [Sortable(goldman.config.SORT)]
          ))
  
          query = """
                  SELECT {cols}, count(*) OVER() as _count
                  FROM {table}
                  """
          query = query.format(
              cols=self.field_cols(model),
              table=rtype,
          )
  
          filters = kwargs.get('filters', [])
          filters += getattr(model, 'search_filters', []) or []
  
          if filters:
              where, param = self.filters_query(filters)
              query += where
  
          model_query = getattr(model, 'search_query', '') or ''
          if filters and model_query:
              model_query = ' AND ' + model_query
          elif model_query:
              model_query = ' WHERE ' + model_query
  
          query += model_query
          query += sorts
          query += pages
  
          signals.pre_search.send(model.__class__, model=model)
  
          result = self.query(query, param=param)
          models = [model(res) for res in result]
  
          if models:
              signals.post_search.send(model.__class__, models=result)
  
          pages = kwargs.get('pages')
          if pages and result:
              pages.total = result[0]['_count']
  
          return models
docs: Search for the model by assorted criteria
  
          Quite a bit needs to happen for a search processing!
  
          The breakdown is we need to apply the query parameters
          where applicable. These include pagination, sorting,
          & filtering.
  
          Additionally, models can declare there own static
          filters or static query that should be applied. For
          static filters a model can opt-in with a `search_filters`
          property & for a static query to append a `search_query`
          property must be present.