コード例 #1
0
    private function getArticleHierarchyWithoutTaxonomy($nodeID)
    {
        $hierarchy = array(
            "title" => ezpI18n::tr("merck", "TABLE OF CONTENTS"),
            "articles" => array()
        );

        $node = eZContentObjectTreeNode::fetch($nodeID);

        $parent = $this->getArticleParent($node);
        if(!$parent->isMain())
        {
            $parent = eZContentObjectTreeNode::fetch($parent->attribute("main_node_id"));
        }

        if(!$parent)
        {
            return $hierarchy;
        }

        $solrFilter = $this->_application->getResultHandler()->solrFilter(false, false);
        if( $solrFilter )
            $filters[] = $solrFilter;

        $filters[] = sprintf('main_node_meta_path_string_ms:%s*', $parent->attribute("path_string"));

        $params = array(
            'indent'        => 'on',
            'q'             => '',
            'start'         => 0,
            'rows'          => 100,
            'fq'            => implode(' AND ' , $filters),
            'fl'            => 'attr_'.ClusterTool::clusterIdentifier().'_url_s,attr_headline_s,meta_main_node_id_si,main_node_meta_path_string_ms,attr_relative_depth_i,subattr_publisher_folder___source_id____s',
            'qt'            => 'ezpublish',
            'sort'          => 'main_node_meta_priority_si asc',
            'explainOther'  => '',
            'hl.fl'         => '',
        );

        return $this->parseSolrResponse(SolrTool::rawSearch( $params ), $hierarchy);
    }
コード例 #2
0
    /**
     * @param ContentListBase $app
     * @param ChannelBlockConfiguration $configuration
     */
    private function addParamsConfiguration(ContentListBase &$app, ChannelBlockConfiguration $configuration)
    {
        $applicationLocalized = CacheApplicationTool::buildLocalizedApplicationByLocalizedId($configuration->attribute("application_localized_id"));
        if(!$applicationLocalized)
        {
            return;
        }

        // Add filter q
        if($configuration->attribute("q"))
        {
            $app->getResultHandler()->searchQuery = $configuration->attribute("q");
        }

        // Add filter fq
        if($configuration->attribute("fq"))
        {
            $app->getResultHandler()->specialFilterChannel = $configuration->getSolrFq();
        }
        else {
            $useDepth = $applicationLocalized->getCustomParameter('ShowParentArticleOnly');
            if (!$useDepth)
            {
                $useDepth = $applicationLocalized->applicationObject()->getCustomParameter('ShowParentArticleOnly');
            }
            if ($useDepth) {
                $app->getResultHandler()->specialFilterChannel = 'attr_relative_depth_i: 0';
            }
        }

        // Sorting
        if($configuration->getChannelBlock()->attribute("sorting_method"))
        {
            $app->getResultHandler()->sortBy = $configuration->getChannelBlock()->attribute("sorting_method");
            if($app->getResultHandler()->sortBy == ContentListSolrQueryHandler::SORT_RANDOM)
            {
                $app->getResultHandler()->randomSortId = "channel_".$configuration->attribute("id")."_random";
            }
        }

        // Limit
        $app->getResultHandler()->limit = $this->getLimit($configuration->getChannelBlock());
    }