code: def query(self, s):
          
          s1 = np.sort([self.order[token] for token in s if token in self.order])
          logging.debug("{} original tokens and {} tokens after applying "
              "frequency order.".format(len(s), len(s1)))
          prefix = self._get_prefix(s1)
          candidates = set([i for p1, token in enumerate(prefix)
                  for i, p2 in self.index[token]
                  if self.position_filter_func(s1, self.sets[i], p1, p2,
                      self.similarity_threshold)])
          logging.debug("{} candidates found.".format(len(candidates)))
          results = deque([])
          for i in candidates:
              s2 = self.sets[i]
              sim = self.similarity_func(s1, s2)
              if sim < self.similarity_threshold:
                  continue
              results.append((i, sim))
          logging.debug("{} verified sets found.".format(len(results)))
          return list(results)
docs: Query the search index for sets similar to the query set.
  
          Args:
              s (Iterable): the query set.
  
          Returns (list): a list of tuples `(index, similarity)` where the index
              is the index of the matching sets in the original list of sets.