Skip to content

Commit

Permalink
Use linktarget
Browse files Browse the repository at this point in the history
  • Loading branch information
Huji authored May 7, 2024
1 parent c8e6eb1 commit 6946ddf
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions HujiBot/weekly.py
Original file line number Diff line number Diff line change
Expand Up @@ -1451,9 +1451,11 @@ def main(sqlnum, maxtime):
(
SELECT COUNT(*)
FROM pagelinks
JOIN linktarget
ON pl_target_id = lt_id
WHERE
pl_namespace = 6
AND pl_title = page_title
lt_namespace = 6
AND lt_title = page_title
) AS links
FROM page
WHERE
Expand Down Expand Up @@ -1665,14 +1667,16 @@ def main(sqlnum, maxtime):
JOIN categorylinks
ON p1.page_id = cl_from
AND cl_to = 'همه_صفحه‌های_ابهام‌زدایی'
JOIN linktarget
ON lt_title = page_title
AND lt_namespace = 0
JOIN pagelinks
ON pl_title = page_title
AND pl_namespace = 0
ON pl_target_id = lt_id
JOIN page p2
ON pl_from = p2.page_id
AND p2.page_namespace = 0
WHERE p1.page_namespace = 0
GROUP BY pl_title
GROUP BY lt_title
ORDER BY cnt DESC
LIMIT 1000
""",
Expand All @@ -1695,8 +1699,10 @@ def main(sqlnum, maxtime):
JOIN categorylinks
ON page_id = cl_from
AND cl_to = 'همه_صفحه‌های_ابهام‌زدایی'
JOIN pagelinks
ON pl_title = page_title
JOIN linktarget
ON lt_title = page_title
JOIN pagelinks
ON pl_target_id = lt_id
JOIN (
SELECT *
FROM page
Expand All @@ -1706,7 +1712,7 @@ def main(sqlnum, maxtime):
) AS tem
ON tem.page_id=pl_from
WHERE
pl_namespace = 0
lt_namespace = 0
AND pl_from_namespace=10
AND NOT tem.page_title LIKE '%_/_%'
AND page.page_namespace = 0
Expand Down

0 comments on commit 6946ddf

Please sign in to comment.