A visual query builder for Logseq database graphs. Build complex Datalog queries using a macOS Finder-style interface with nested filter groups, see live results, and copy the generated query to use in Logseq.
Try it online (requires Logseq API enabled - see Prerequisites)
- Visual Filter Builder - Add and combine filters using dropdowns and inputs
- Nested Filter Groups - Create complex boolean logic with ANY/ALL/NONE groups (like macOS Finder)
- Live Results Preview - See query results as you build
- Property Type Awareness - Automatic type detection with smart input controls
- Auto-complete - Suggestions for tags, pages, and properties
- Copy-Paste Ready - Generated queries ready to use in Logseq
- Dark/Light Theme - Match your Logseq theme preference
- No extra server needed - Connects directly to Logseq's built-in HTTP API
This tool connects to Logseq's built-in HTTP API (no extra server needed):
- Enable Developer Mode: Logseq → Settings → Advanced → enable "Developer mode"
- Restart Logseq
- Enable HTTP API: Settings → API Server → enable "HTTP APIs server"
- Create a token: Click "Authorization tokens" → create a token
- Logseq DB Graph - This tool works with database graphs only (not markdown/file-based graphs)
- Enable the Logseq HTTP API (see Prerequisites)
- Open https://kerim.github.io/logseq-db-query-builder/
- Paste your API token and click Connect
- Start building queries!
Note: Safari does not support the online version (it blocks HTTPS-to-localhost requests). Use Chrome or Firefox instead, or run locally.
-
Clone this repository:
git clone https://github.com/kerim/logseq-db-query-builder.git
-
Open
index.htmlin your browser (or use a local server) -
Enable the Logseq HTTP API and paste your token
- Paste your API token and click Connect
- Click "+ Filter" to add a filter
- Choose filter type (tags, page, property, etc.)
- Set the value and click Search
- Copy the query to use in Logseq
Create complex queries with nested groups:
- Click "+ Group" to add a nested filter group
- Choose the group's match mode:
- ALL - All filters must match (AND)
- ANY - Any filter can match (OR)
- NONE - No filters should match (NOT)
- Add filters or more groups inside
Example: Find tasks that are either urgent OR high priority, but NOT archived:
ALL of the following:
├─ [tags] is [Task]
├─ ANY of the following:
│ ├─ [priority] is [Urgent]
│ └─ [priority] is [High]
└─ NONE of the following:
└─ [tags] is [archived]
| Filter Type | Description | Options |
|---|---|---|
| page | Match page names | is, contains, starts-with, ends-with |
| tags | Find items with specific tags | Include child tags option |
| full text search | Search block content | contains, equals |
| property | Match property values | Auto-detects type (text, reference, boolean, date, number) |
| page reference | Find blocks linking to pages | Auto-complete |
| task | Find task items | Status filter with multi-select |
| priority | Filter by priority | Urgent, High, Medium, Low |
| between (dates) | Date range queries | created-at, updated-at, journal-day |
When you select a property, the tool automatically detects its type and provides appropriate input controls:
- Reference properties → Dropdown or checkboxes with actual values
- Boolean properties → Checked/Unchecked radio buttons
- Date properties → Date picker with comparison operators
- Number properties → Number input with comparison operators
- Text properties → Text input
- Copy the generated query
- In Logseq, type
/queryand select "Advanced query" - Paste the query
- Press Enter to execute
logseq-db-query-builder/
├── index.html - Main page
├── styles/
│ └── main.css - Logseq-inspired styling
└── js/
├── api.js - Logseq built-in API communication
├── queryGenerator.js - Datalog query generation
├── filters.js - Filter UI and tree structure
├── autocomplete.js - Auto-complete component
└── app.js - Main application logic
- Logseq - The knowledge management app
1. Logseq API not enabled
- Open Logseq → Settings → Advanced → enable "Developer mode"
- Restart Logseq
- Settings → API Server → enable "HTTP APIs server"
2. Invalid token
- Go to Settings → API Server → "Authorization tokens"
- Create a new token or copy an existing one
- Paste it in the token field and click Connect
3. Ad blocker blocking localhost requests
- Brave Browser: Click the Shields icon → disable for this site
- uBlock Origin: Click icon → click the power button to disable for this site
- Other ad blockers: Whitelist
127.0.0.1:12315or disable temporarily
This is especially common when using the online version since ad blockers may block requests from external sites to localhost.
4. Browser blocking local network access
When using the online version (HTTPS), your browser may block requests to the local Logseq API (http://127.0.0.1:12315). Here's the browser compatibility:
| Browser | HTTPS → HTTP localhost | What to do |
|---|---|---|
| Chrome/Edge/Brave/Opera (v142+, Oct 2025) | Permission prompt appears | Click "Allow". If denied: Settings → Privacy & Security → Site Settings → Local Network Access → allow for this site. Details |
| Chrome/Edge (pre-142) | Works | Loopback addresses exempted from mixed content blocking |
| Firefox (55+) | Works | http://127.0.0.1 treated as secure since Firefox 55 (bug #903966) |
| Safari | Does not work | Safari blocks all HTTPS→HTTP localhost requests. WebKit bug #171934 open since 2017, unresolved. Use Chrome, Firefox, or run locally. |
| Brave | Same as Chrome | Also disable Shields for this site (click Shields icon → disable) |
- Problem: Invalid query or graph access issue
- Solution: Try a simpler filter first, check browser console for details
- v0.5.0 - Disconnect button, HTTPS/browser detection for local network access
- v0.4.5 - Fix journal-date dropdowns layout (side-by-side instead of stacked)
- v0.4.4 - Fix autocomplete on GitHub Pages (cache-busting for JS/CSS)
- v0.4.3 - Fix "Untitled" results display with short-key fallbacks
- v0.4.1 - Fix quote escaping, entity-reference schema handling, result flattening
- v0.4.0 - Migrate to Logseq built-in API (no extra server needed)
- v0.3.1 - Journal-date relative filtering, autocomplete positioning fix
- v0.2.0 - Nested filter groups with AND/OR/NOT logic
- v0.1.x - Property type awareness, auto-complete
- v0.0.x - Initial release with basic filters
See CHANGELOG.md for detailed version history.
MIT
Built for Logseq DB graphs. Not affiliated with Logseq official team.