docs: public Deferred<byte[]> resolveTags(final TSDB tsdb, 
        final Set<String> literals) {
      final Config config = tsdb.getConfig();
      
      /**
       * Allows the filter to avoid killing the entire query when we can't resolve
       * a tag value to a UID.
       */
      class TagVErrback implements Callback<byte[], Exception> {
        @Override
        public byte[] call(final Exception e) throws Exception {
          if (config.getBoolean("tsd.query.skip_unresolved_tagvs")) {
            LOG.warn("Query tag value not found: " + e.getMessage());
            return null;
          } else {
            throw e;
          }
        }
      }
  
      /**
       * Stores the non-null UIDs in the local list and then sorts them in
       * prep for use in the regex filter
       */
      class ResolvedTagVCB implements Callback<byte[], ArrayList<byte[]>> {
        @Override
        public byte[] call(final ArrayList<byte[]> results) 
            throws Exception {
          tagv_uids = new ArrayList<byte[]>(results.size() - 1);
          for (final byte[] tagv : results) {
            if (tagv != null) {
              tagv_uids.add(tagv);
            }
          }
          Collections.sort(tagv_uids, Bytes.MEMCMP);
          return tagk_bytes;
        }
      }
      
      /**
       * Super simple callback to set the local tagk and returns null so it won't
       * be included in the tag value UID lookups.
       */
      class ResolvedTagKCB implements Callback<byte[], byte[]> {
        @Override
        public byte[] call(final byte[] uid) throws Exception {
          tagk_bytes = uid;
          return null;
        }
      }
  
      final List<Deferred<byte[]>> tagvs = 
          new ArrayList<Deferred<byte[]>>(literals.size());
      for (final String tagv : literals) {
        tagvs.add(tsdb.getUIDAsync(UniqueIdType.TAGV, tagv)
            .addErrback(new TagVErrback()));
      }
      // ugly hack to resolve the tagk UID. The callback will return null and we'll
      // remove it from the UID list.
      tagvs.add(tsdb.getUIDAsync(UniqueIdType.TAGK, tagk)
        .addCallback(new ResolvedTagKCB()));
      return Deferred.group(tagvs).addCallback(new ResolvedTagVCB());
    }