1
0
Fork
You've already forked search
1

feat: admin page delete domain functionality #14

Merged
sznowicki merged 3 commits from issue-13-admin-delete-domain into main 2026年03月02日 18:30:06 +01:00
Collaborator
Copy link

Add ability to remove all URLs from a specific domain from both MongoDB and MeiliSearch databases.

Changes:

  • Add deleteDocumentsByDomain() to web/server/lib/mongo.js (deletes by index field)
  • Add deleteDocumentsByDomain() to web/server/lib/search.js (deletes by hostname filter)
  • Add adminDeleteDomainController with confirmation dialog
  • Add delete button next to each domain in admin view
  • Add route /admin/delete-domain to web/server/index.js

Usage:

Go to /admin, find the domain in the "Not yet indexed pages by domain" list, click Delete. Confirm to remove all URLs from that domain from both databases.

Fixes #13

Add ability to remove all URLs from a specific domain from both MongoDB and MeiliSearch databases. ## Changes: - Add deleteDocumentsByDomain() to web/server/lib/mongo.js (deletes by index field) - Add deleteDocumentsByDomain() to web/server/lib/search.js (deletes by hostname filter) - Add adminDeleteDomainController with confirmation dialog - Add delete button next to each domain in admin view - Add route /admin/delete-domain to web/server/index.js ## Usage: Go to /admin, find the domain in the "Not yet indexed pages by domain" list, click Delete. Confirm to remove all URLs from that domain from both databases. Fixes #13
@ -154,0 +156,4 @@
const db = await getDb();
// Delete all documents where index matches the domain
const result = await db.collection(envs.MONGO_COLLECTION).deleteMany({
index: domain

That here doesn't make much sense.

We need to remove them from three different mongo collections.

sources (=envs.MONGO.COLLECTION) has this example shape:

{
 "_id": {
 "$oid": "65d90842c1ca6c9931914ca5"
 },
 "url": "https://nowicki.io",
 "index": "blogs",
 "lastCrawledAt": 1766943045632
}

sources-failed

{
 "_id": {
 "$oid": "65d933417fac83c7e07bed72"
 },
 "index": "docs",
 "url": "https://www.postgresql.org/docs/16/custom-rmgr.html",
 "crawledAt": 1708733249885
}

And sources-links

{
 "_id": {
 "$oid": "65d90842c1ca6c9931914d13"
 },
 "index": "blogs",
 "rootUrl": "https://nowicki.io",
 "url": "https://nowicki.io",
 "lastCrawledAt": 1766937934982
}
That here doesn't make much sense. We need to remove them from three different mongo collections. `sources` (=envs.MONGO.COLLECTION) has this example shape: ``` { "_id": { "$oid": "65d90842c1ca6c9931914ca5" }, "url": "https://nowicki.io", "index": "blogs", "lastCrawledAt": 1766943045632 } ``` `sources-failed` ``` { "_id": { "$oid": "65d933417fac83c7e07bed72" }, "index": "docs", "url": "https://www.postgresql.org/docs/16/custom-rmgr.html", "crawledAt": 1708733249885 } ``` And `sources-links` ``` { "_id": { "$oid": "65d90842c1ca6c9931914d13" }, "index": "blogs", "rootUrl": "https://nowicki.io", "url": "https://nowicki.io", "lastCrawledAt": 1766937934982 } ```
@ -9,3 +9,3 @@
<ul class="list">
{{#domains}}
<li>{{ domain }} ({{ count }})</li>
<li>

This only shows up when something is not yet indexed, I guess we should change this whole logic and make it always visible with counts

This only shows up when something is not yet indexed, I guess we should change this whole logic and make it always visible with counts
botjadwiga force-pushed issue-13-admin-delete-domain from 889114f555 to 4998183d5b 2026年03月02日 17:06:31 +01:00 Compare
@ -188,0 +201,4 @@
const ids = searchResult.hits.map(h => h.id);
if (ids.length > 0) {
await client.index(index).deleteDocuments(ids);
Why don't you use `deleteDocuments` with `filter`? https://www.meilisearch.com/docs/reference/api/documents/delete-documents-by-filter
@ -98,1 +125,4 @@
return result;
};
export const getNotIndexedByDomain = async () => {

This is no longer needed.

This is no longer needed.
botjadwiga force-pushed issue-13-admin-delete-domain from 4998183d5b to 2b15b0ccd7 2026年03月02日 17:31:46 +01:00 Compare
botjadwiga force-pushed issue-13-admin-delete-domain from 2b15b0ccd7 to 1885eaf7fe 2026年03月02日 17:40:30 +01:00 Compare
botjadwiga force-pushed issue-13-admin-delete-domain from 1885eaf7fe to 3a6dfac3c8 2026年03月02日 17:43:07 +01:00 Compare
botjadwiga force-pushed issue-13-admin-delete-domain from 3a6dfac3c8 to 8d217013f5 2026年03月02日 17:45:07 +01:00 Compare
Add ability to remove all URLs from a specific domain from both
MongoDB and MeiliSearch databases.
Changes:
- Add deleteDocumentsByDomain() to web/server/lib/mongo.js
 - Simple regex matching validated domain in URL
- Add getIndexedByDomain() to show all indexed domains
- Add deleteDocumentsByDomain() to web/server/lib/search.js
 - Uses MeiliSearch filter-based deletion
- Add adminDeleteDomainController with input validation
 - Validates domain format, returns 403 if invalid
- Add delete form/button to web/server/views/admin.html
- Add route /admin/delete-domain to web/server/index.js
- Update view heading from "Not yet indexed" to "Indexed pages"
- Remove unused getNotIndexedByDomain() function
Fixes #13 

Part of Claude Code vs Jadwiga: https://social.josko.org/@sn/116160502032206595

Part of Claude Code vs Jadwiga: https://social.josko.org/@sn/116160502032206595
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kukei/search!14
Reference in a new issue
kukei/search
No description provided.
Delete branch "issue-13-admin-delete-domain"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?