public function getQbForFamiliesAndLabel(array $families, $term)
    {
        // Removing empty terms with wildcards on both sides
        if ('%%' === $term) {
            $term = '%';
        }

        // Specific optimisation for match-all queries
        if ('%' === $term) {
            return $this->repository->getQbForFamilies($families);
        }

        $eavQb = $this->repository->createEAVQueryBuilder();
        $orCondition = [];

        foreach ($families as $family) {
            $eavQbAttributes = $this->resolveEavQbAttributes($family, $eavQb);
            foreach ($eavQbAttributes as $eavQbAttribute) {
                $orCondition[] = $eavQbAttribute->like($term);
            }
        }

        return $eavQb->apply($eavQb->getOr($orCondition));
    }