protected function filterSearch(PaginateFinderConfiguration $configuration, Stage $qa)
    {
        $siteName = $configuration->getSearchIndex('site_name');
        if (null !== $siteName && '' !== $siteName) {
            $qa->match(array('siteName' => new \MongoRegex('/.*' . $siteName . '.*/i')));
        }

        $locale = $configuration->getSearchIndex('locale');
        if (null !== $locale && '' !== $locale) {
            $qa->match(array('locale' => new \MongoRegex('/.*' . $locale . '.*/i')));
        }

        $routePattern = $configuration->getSearchIndex('route_pattern');
        if (null !== $routePattern && '' !== $routePattern) {
            $qa->match(array('routePattern' => new \MongoRegex('/.*' . $routePattern . '.*/i')));
        }

        $redirection = $configuration->getSearchIndex('redirection');
        if (null !== $redirection && '' !== $redirection) {
            $qa->match(array('$or' => array(
                array('url'    => new \MongoRegex('/.*' . $redirection . '.*/i')),
                array('nodeId' => new \MongoRegex('/.*' . $redirection . '.*/i'))
            )));
        }

        $permanent = $configuration->getSearchIndex('permanent');
        if (null !== $redirection && '' !== $permanent) {
            if ('true' == $permanent) {
                $qa->match(array('permanent' => true));
            }
            if ('false' == $permanent) {
                $qa->match(array('permanent' => false));
            }
        }

        return $qa;
    }
protected function filterSearch(PaginateFinderConfiguration $configuration, Stage $qa)
    {
        $siteName = $configuration->getSearchIndex('site_name');
        if (null !== $siteName && '' !== $siteName) {
            $qa->match(array('siteName' => new \MongoRegex('/.*' . $siteName . '.*/i')));
        }

        $locale = $configuration->getSearchIndex('locale');
        if (null !== $locale && '' !== $locale) {
            $qa->match(array('locale' => new \MongoRegex('/.*' . $locale . '.*/i')));
        }

        $routePattern = $configuration->getSearchIndex('route_pattern');
        if (null !== $routePattern && '' !== $routePattern) {
            $qa->match(array('routePattern' => new \MongoRegex('/.*' . $routePattern . '.*/i')));
        }

        $redirection = $configuration->getSearchIndex('redirection');
        if (null !== $redirection && '' !== $redirection) {
            $qa->match(array('$or' => array(
                array('url'    => new \MongoRegex('/.*' . $redirection . '.*/i')),
                array('nodeId' => new \MongoRegex('/.*' . $redirection . '.*/i'))
            )));
        }

        $permanent = $configuration->getSearchIndex('permanent');
        if (null !== $redirection && '' !== $permanent) {
            if ('true' == $permanent) {
                $qa->match(array('permanent' => true));
            }
            if ('false' == $permanent) {
                $qa->match(array('permanent' => false));
            }
        }

        return $qa;
    }
@param PaginateFinderConfiguration $configuration
@param Stage                       $qa

@return array