private def findImpl()

in atlas-core/src/main/scala/com/netflix/atlas/core/index/SimpleTagIndex.scala [52:85]


  private def findImpl(query: Query): Set[Int] = {
    import com.netflix.atlas.core.model.Query.*
    query match {
      case And(q1, q2) =>
        findImpl(q1).intersect(findImpl(q2))
      case Or(q1, q2) =>
        findImpl(q1).union(findImpl(q2))
      case Not(q) =>
        all.diff(findImpl(q))
      case Equal(k, v) =>
        index.get(k) match {
          case Some(vidx) => vidx.getOrElse(v, Set.empty[Int])
          case None       => Set.empty[Int]
        }
      case q: KeyValueQuery =>
        index.get(q.k) match {
          case Some(vidx) =>
            vidx.foldLeft(Set.empty[Int]) { (acc, v) =>
              if (q.check(v._1)) acc.union(v._2) else acc
            }
          case None => Set.empty[Int]
        }
      case HasKey(k) =>
        index.get(k) match {
          case Some(vidx) =>
            vidx.foldLeft(Set.empty[Int]) { (acc, v) =>
              acc.union(v._2)
            }
          case None => Set.empty[Int]
        }
      case True  => all
      case False => Set.empty[Int]
    }
  }