You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cc06496
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+40-11Lines changed: 40 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Brightwave-Style Crawler Project
1
+
Crawler Project
2
2
3
3
This project implements a single-machine web crawler and keyword search engine with a live dashboard. It is designed to satisfy the assignment requirements around:
4
4
@@ -12,7 +12,7 @@ This project implements a single-machine web crawler and keyword search engine w
12
12
The system has two major parts:
13
13
14
14
-**Crawler service**: creates and runs crawl jobs, supports pause/resume, tracks queue and worker state, and persists job state.
15
-
-**Search service**: indexes crawled pages and answers queries with relevant URLs and metadata.
15
+
-**Search service**: keeps classic keyword ranking and semantic vector ranking side by side, and answers queries with relevant URLs and metadata.
16
16
17
17
## What The System Does
18
18
@@ -26,11 +26,12 @@ When you submit an indexing request (`origin`, `k`), the backend creates a crawl
26
26
27
27
### 2) Search
28
28
29
-
Search uses an in-memory inverted index built from page title and body text.
29
+
Search exposes two modes over indexed pages: classic term search and semantic vector search.
30
30
31
-
- Tokenization is regex-based and case-insensitive.
31
+
- Classic tokenization is regex-based and case-insensitive.
- Results include `relevant_url`, `origin_url`, and `depth` (plus score/title for UI visibility).
33
-
-Search is available while crawlers are still running, so newly indexed pages appear as they are discovered.
34
+
-Both search modes are available while crawlers are still running, so newly indexed pages appear as they are discovered.
34
35
-`I'm Feeling Lucky` picks a **random** result from matches and opens it.
35
36
36
37
### 3) Runtime Controls and Visibility
@@ -41,8 +42,10 @@ The dashboard allows:
41
42
- pausing and resuming existing jobs,
42
43
- changing **global queue limit** across all jobs,
43
44
- changing **per-job request rate** live from each job card,
45
+
- starting, pausing, and resuming **embedding jobs** with configurable embed speed and max-page limit,
44
46
- inspecting detailed job state (frontier preview, counters, recent events),
45
-
- viewing global metrics (processed/discovered/duplicates/failed, queue pressure, workers).
47
+
- viewing global metrics (processed/discovered/duplicates/failed, queue pressure, workers),
48
+
- viewing embedding progress metrics (embedded/remaining/failed and `% embedded`).
46
49
47
50
## Architecture Summary
48
51
@@ -52,7 +55,9 @@ The dashboard allows:
52
55
-`pages` table for indexed page snapshots,
53
56
-`jobs` table for job metadata and counters,
54
57
-`job_visited` and `job_frontier` for resumable crawl state,
55
-
-`job_events` for job timeline details.
58
+
-`job_events` for job timeline details,
59
+
-`page_embeddings` for semantic vectors,
60
+
-`embedding_jobs` for resumable embedding job state.
56
61
57
62
## API Endpoints
58
63
@@ -64,6 +69,9 @@ The dashboard allows:
64
69
-`GET /search?query=...&limit=...`
65
70
Returns relevant indexed URLs.
66
71
72
+
-`GET /search/semantic?query=...&limit=...`
73
+
Returns semantic nearest-neighbor matches over embedded pages.
74
+
67
75
### Job Control and Details
68
76
69
77
-`GET /jobs/{job_id}`
@@ -86,6 +94,26 @@ The dashboard allows:
86
94
-`POST /settings/queue-limit`
87
95
Updates the **global** queue limit shared by all jobs.
88
96
97
+
### Embeddings
98
+
99
+
-`POST /embeddings/jobs/start`
100
+
Starts a manual embedding job with configurable speed and max-page scope.
101
+
102
+
-`GET /embeddings/jobs`
103
+
Lists embedding jobs and progress.
104
+
105
+
-`GET /embeddings/jobs/{job_id}`
106
+
Returns full embedding job status and counters.
107
+
108
+
-`POST /embeddings/jobs/{job_id}/pause`
109
+
Pauses a running embedding job.
110
+
111
+
-`POST /embeddings/jobs/{job_id}/resume`
112
+
Resumes a paused embedding job.
113
+
114
+
-`POST /embeddings/jobs/{job_id}/rate-limit`
115
+
Updates embedding speed (`pages/s`) for a job.
116
+
89
117
## Backpressure and Load Management
90
118
91
119
The crawler enforces load control using:
@@ -124,17 +152,18 @@ Open the printed Vite URL (usually `http://127.0.0.1:5173`).
124
152
3. Start a second crawler to demonstrate concurrent jobs.
125
153
4. Update global queue limit and per-job req/s live.
126
154
5. Pause and resume one job.
127
-
6. Run Search and `I'm Feeling Lucky`.
128
-
7. Click a job card and inspect frontier preview + event timeline.
155
+
6. Open Embeddings mode and start a manual embedding run with speed/limit.
156
+
7. Run Search and compare Classical vs Semantic result tables.
157
+
8. Click a crawler job card and inspect frontier preview + event timeline.
129
158
130
159
## Limitations (Current Scope)
131
160
132
-
-Search is term-frequency based (no semantic embeddings).
161
+
-Semantic quality depends on currently stored page snippets and embedding coverage.
133
162
- Single-process deployment (no horizontal scaling).
134
163
- No robots.txt policy enforcement yet.
135
164
- No hard per-domain crawl budget yet.
136
165
137
-
## Production Next Steps (1-2 Paragraphs)
166
+
## Production Next Steps
138
167
139
168
To productionize this system, the first step is to separate responsibilities into independent services: crawl scheduler, crawl workers, indexing pipeline, and query API. The current asyncio loop can evolve into a worker template that pulls tasks from a durable queue and writes normalized page documents to persistent storage. The in-memory inverted index should be replaced with a dedicated search layer (for example BM25-capable engine) to improve ranking quality, scalability, and operational resilience.
0 commit comments