Skip to content

Commit 130ffea

Browse files
committed
chore(pipeline): remove implementação antiga de IndexJobsInValkey comentada
1 parent 043c35b commit 130ffea

1 file changed

Lines changed: 0 additions & 79 deletions

File tree

scraper-go/internal/pipeline/pipeline.go

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -87,85 +87,6 @@ func Run(ctx context.Context, adapterList []adapters.Adapter, req models.ScrapeR
8787
return dedup.DedupeJobs(allJobs)
8888
}
8989

90-
// func IndexJobsInValkey(ctx context.Context, rdb *redis.Client, jobs []models.Job, keywords []string) {
91-
// if rdb == nil || len(jobs) == 0 {
92-
// return
93-
// }
94-
95-
// globalIndexKey := "scraper:jobs:index"
96-
// indexTTL := 72 * time.Hour
97-
98-
// // Limpa os índices de keyword anteriores (composto + sub-termos)
99-
// for _, kw := range keywords {
100-
// sanitizedKw := strings.ToLower(strings.TrimSpace(kw))
101-
// if sanitizedKw == "" {
102-
// continue
103-
// }
104-
105-
// normalizedForDel := strings.ReplaceAll(sanitizedKw, "/", " ")
106-
// normalizedForDel = strings.Join(strings.Fields(normalizedForDel), " ")
107-
// rdb.Del(ctx, fmt.Sprintf("scraper:jobs:keyword:%s", normalizedForDel))
108-
109-
// for _, term := range strings.Fields(normalizedForDel) {
110-
// rdb.Del(ctx, fmt.Sprintf("scraper:jobs:keyword:%s", term))
111-
// }
112-
// }
113-
114-
// for _, job := range jobs {
115-
// // ✅ Usa o ID estável como membro de todos os Sets,
116-
// // igual ao que jobstore.SaveBatch faz — nunca a URL bruta
117-
// id := jobstore.StableID(&job)
118-
// if id == "" {
119-
// continue
120-
// }
121-
122-
// // Índice global: apenas IDs (sem duplicar com URLs)
123-
// rdb.SAdd(ctx, globalIndexKey, id)
124-
125-
// titleLower := strings.ToLower(job.Title)
126-
// descLower := strings.ToLower(job.Description)
127-
128-
// for _, kw := range keywords {
129-
// sanitizedKw := strings.ToLower(strings.TrimSpace(kw))
130-
// if sanitizedKw == "" {
131-
// continue
132-
// }
133-
134-
// normalizedKw := strings.ReplaceAll(sanitizedKw, "/", " ")
135-
// subTerms := strings.Fields(normalizedKw)
136-
137-
// // Keyword composta: indexa só se todos os sub-termos aparecem na vaga
138-
// matchAll := true
139-
// for _, term := range subTerms {
140-
// if !strings.Contains(titleLower, term) && !strings.Contains(descLower, term) {
141-
// matchAll = false
142-
// break
143-
// }
144-
// }
145-
146-
// if matchAll {
147-
// fullKey := fmt.Sprintf("scraper:jobs:keyword:%s", strings.Join(subTerms, " "))
148-
// rdb.SAdd(ctx, fullKey, id)
149-
// rdb.Expire(ctx, fullKey, indexTTL)
150-
// }
151-
152-
// // Sub-termos individuais: indexa cada um independentemente
153-
// for _, term := range subTerms {
154-
// if term == "" {
155-
// continue
156-
// }
157-
// if strings.Contains(titleLower, term) || strings.Contains(descLower, term) {
158-
// termKey := fmt.Sprintf("scraper:jobs:keyword:%s", term)
159-
// rdb.SAdd(ctx, termKey, id)
160-
// rdb.Expire(ctx, termKey, indexTTL)
161-
// }
162-
// }
163-
// }
164-
// }
165-
166-
// rdb.Expire(ctx, globalIndexKey, indexTTL)
167-
// slog.Info("Valkey invertido atualizado", "total_vagas", len(jobs))
168-
// }
16990
func IndexJobsInValkey(ctx context.Context, rdb *redis.Client, jobs []models.Job, keywords []string) {
17091
if rdb == nil || len(jobs) == 0 {
17192
return

0 commit comments

Comments
 (0)