code: def get_record_sets(record):
      
      # get lists of sets with search_pattern equals to None but already in the
      # set list inside the record
      record_sets = set(record.get('_oai', {}).get('sets', []))
      for spec in _build_cache():
          if spec in record_sets:
              yield spec
  
      # get list of sets that match using percolator
      index, doc_type = RecordIndexer().record_to_index(record)
      document = record.dumps()
  
      percolator_doc_type = _get_percolator_doc_type(index)
      _create_percolator_mapping(index, percolator_doc_type)
      results = _percolate_query(index, doc_type, percolator_doc_type, document)
      prefix = 'oaiset-'
      prefix_len = len(prefix)
      for match in results:
          set_name = match['_id']
          if set_name.startswith(prefix):
              name = set_name[prefix_len:]
              yield name
  
      raise StopIteration
docs: Find matching sets.