Swiftriver\EventHandlers\TagClusteringEventHandler::ScoreSql PHP Method

ScoreSql() private method

private ScoreSql ( $contentIds )
    private function ScoreSql($contentIds)
    {
        $idString = $this->IdsToString($contentIds);
        return "select\n                c.id as 'contentId',\n                SUM(a.tagCount) /\n                    (\n                        select\n                            count(*)\n                        from\n                            SC_Content_Tags\n                    ) as 'score'\n            from\n                (\n                    select\n                        t.id as 'tagId',\n                        t.text as 'tagText',\n                        count(t.id) as 'tagCount'\n                    from\n                        SC_Tags t\n                            join SC_Content_Tags ct on t.id = ct.tagId\n                                join SC_Content c on c.id = ct.contentId\n                    group by\n                        t.id\n                ) a\n                join SC_Content_Tags ct on a.tagId = ct.tagId\n                    join SC_Content c on ct.contentId = c.id\n            where\n                a.tagCount > 1\n                and\n                c.id in {$idString}\n            group by\n                c.id";
    }