File tree Expand file tree Collapse file tree 1 file changed +0
-68
lines changed
Expand file tree Collapse file tree 1 file changed +0
-68
lines changed Original file line number Diff line number Diff line change @@ -101,71 +101,3 @@ ORDER BY
101101 * (10 * EXTRACT(DAY FROM (NOW() - sa .updated_at )))
102102 ) DESC
103103LIMIT :mylimit;
104-
105-
106-
107- WITH latest_descriptions AS (
108- SELECT
109- DISTINCT ON
110- (store_app)
111- sad .id AS description_id,
112- store_app,
113- description_short,
114- description
115- FROM
116- store_apps_descriptions sad
117- WHERE
118- language_id = 1
119- ORDER BY
120- store_app,
121- updated_at DESC
122- ),
123- latest_extractions AS (
124- SELECT
125- DISTINCT ON
126- (store_app)
127- sad .store_app ,
128- ak .extracted_at AS last_extracted_at
129- FROM
130- store_apps_descriptions sad
131- LEFT JOIN
132- app_keywords ak
133- ON
134- ak .description_id = sad .id
135- WHERE
136- ak .extracted_at <= ' 2025-11-02'
137- OR ak .extracted_at IS NULL
138- ORDER BY
139- sad .store_app ,
140- ak .extracted_at DESC
141- ),
142- base AS (
143- SELECT
144- le .store_app ,
145- ld .description_id ,
146- le .last_extracted_at ,
147- ld .description_short ,
148- ld .description
149- FROM
150- latest_extractions le
151- JOIN latest_descriptions ld ON
152- le .store_app = ld .store_app
153- )
154- SELECT
155- b .store_app ,
156- b .description_id ,
157- b .last_extracted_at ,
158- b .description_short ,
159- b .description
160- FROM
161- base b
162- JOIN app_global_metrics_latest agml ON b .store_app = agml .store_app
163- ORDER BY
164- (CASE WHEN b .last_extracted_at IS NULL THEN 1 ELSE 0 END) DESC , -- always crawl new ones first
165- (
166- GREATEST(
167- COALESCE(agml .installs , 0 ),
168- COALESCE(agml .rating_count ::bigint , 0 )
169- )
170- * (10 * COALESCE(EXTRACT(DAY FROM (NOW() - b .last_extracted_at )), 1 ))
171- ) DESC
You can’t perform that action at this time.
0 commit comments