feat(search): support platform and benchmark config filters
Some checks failed
Build and Publish Docker Image / deploy (push) Failing after 1m2s
Some checks failed
Build and Publish Docker Image / deploy (push) Failing after 1m2s
Add platform handling to submissions and persist a normalized value (`windows`, `linux`, `macos`) with a default of `windows` when omitted. Extend search/index filtering to support `thread`, `platform`, `intensity`, and `durationSecs` alongside existing text/CPU token matching, and wire these params through request parsing, page data, and navigation URLs. Update API/README docs and examples to reflect the new submission inputs and search capabilities so users can run more precise queries.feat(search): support platform and benchmark config filters Add platform handling to submissions and persist a normalized value (`windows`, `linux`, `macos`) with a default of `windows` when omitted. Extend search/index filtering to support `thread`, `platform`, `intensity`, and `durationSecs` alongside existing text/CPU token matching, and wire these params through request parsing, page data, and navigation URLs. Update API/README docs and examples to reflect the new submission inputs and search capabilities so users can run more precise queries.
This commit is contained in:
28
README.md
28
README.md
@@ -5,7 +5,7 @@ Production-oriented Go web application for ingesting CPU benchmark results, stor
|
||||
## Features
|
||||
|
||||
- `POST /api/submit` accepts either `application/json` or `multipart/form-data`.
|
||||
- `GET /api/search` performs case-insensitive token matching against submitter/general fields and CPU brand strings.
|
||||
- `GET /api/search` performs case-insensitive token matching against submitter/general fields and CPU brand strings, with explicit thread-mode, platform, intensity, and duration filters.
|
||||
- `GET /` renders the latest submissions with search and pagination.
|
||||
- BadgerDB stores each submission under a reverse-timestamp key so native iteration returns newest records first.
|
||||
- A startup-loaded in-memory search index prevents full DB deserialization for every query.
|
||||
@@ -17,6 +17,7 @@ Each stored submission contains:
|
||||
|
||||
- `submissionID`: server-generated UUID
|
||||
- `submitter`: defaults to `Anonymous` if omitted
|
||||
- `platform`: normalized to `windows`, `linux`, or `macos`; defaults to `windows` if omitted
|
||||
- `submittedAt`: server-side storage timestamp
|
||||
- Benchmark payload fields:
|
||||
- `config`
|
||||
@@ -84,15 +85,21 @@ Accepted content types:
|
||||
|
||||
JSON requests support either:
|
||||
|
||||
1. A wrapper envelope with `submitter` and nested `benchmark`
|
||||
1. A wrapper envelope with `submitter`, `platform`, and nested `benchmark`
|
||||
2. A raw benchmark JSON body, with optional submitter provided via:
|
||||
- query string `?submitter=...`
|
||||
- header `X-Submitter`
|
||||
- top-level `submitter` field
|
||||
- query string `?platform=...`
|
||||
- header `X-Platform`
|
||||
- top-level `platform` field
|
||||
|
||||
`platform` is stored for every submission. Supported values are `windows`, `linux`, and `macos`. If the client does not send it, the server defaults to `windows`.
|
||||
|
||||
Multipart requests support:
|
||||
|
||||
- `submitter` text field
|
||||
- `platform` text field
|
||||
- benchmark JSON as one of these file fields: `benchmark`, `file`, `benchmarkFile`
|
||||
- or benchmark JSON as text fields: `benchmark`, `payload`, `result`, `data`
|
||||
|
||||
@@ -102,6 +109,7 @@ Example success response:
|
||||
{
|
||||
"success": true,
|
||||
"submissionID": "8f19d442-1be0-4989-97cf-3f8ee6b61548",
|
||||
"platform": "windows",
|
||||
"submitter": "Workstation-Lab-A",
|
||||
"submittedAt": "2026-04-15T15:45:41.327225Z"
|
||||
}
|
||||
@@ -113,11 +121,15 @@ Query parameters:
|
||||
|
||||
- `text`: token-matches submitter and general searchable fields
|
||||
- `cpu`: token-matches `cpuInfo.brandString`
|
||||
- `thread`: `single` or `multi`
|
||||
- `platform`: `windows`, `linux`, or `macos`
|
||||
- `intensity`: exact match on `config.intensity`
|
||||
- `durationSecs`: exact match on `config.durationSecs`
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
curl "http://localhost:8080/api/search?text=intel&cpu=13700"
|
||||
curl "http://localhost:8080/api/search?text=intel&cpu=13700&thread=multi&platform=windows&intensity=10&durationSecs=30"
|
||||
```
|
||||
|
||||
### `GET /`
|
||||
@@ -127,13 +139,17 @@ Query parameters:
|
||||
- `page`
|
||||
- `text`
|
||||
- `cpu`
|
||||
- `thread`
|
||||
- `platform`
|
||||
- `intensity`
|
||||
- `durationSecs`
|
||||
|
||||
Examples:
|
||||
|
||||
```text
|
||||
http://localhost:8080/
|
||||
http://localhost:8080/?page=2
|
||||
http://localhost:8080/?text=anonymous&cpu=ryzen
|
||||
http://localhost:8080/?text=anonymous&cpu=ryzen&thread=multi&platform=windows&intensity=10&durationSecs=20
|
||||
```
|
||||
|
||||
## Request Examples
|
||||
@@ -149,6 +165,7 @@ You can also submit one of the provided sample payloads directly:
|
||||
```bash
|
||||
curl -X POST "http://localhost:8080/api/submit?submitter=Example-CLI" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-Platform: windows" \
|
||||
--data-binary @example_jsons/5800X/cpu-bench-result.json
|
||||
```
|
||||
|
||||
@@ -157,6 +174,7 @@ Or as multipart:
|
||||
```bash
|
||||
curl -X POST "http://localhost:8080/api/submit" \
|
||||
-F "submitter=Example-Multipart" \
|
||||
-F "platform=linux" \
|
||||
-F "benchmark=@example_jsons/i9/cpu-bench-result.json;type=application/json"
|
||||
```
|
||||
|
||||
@@ -168,7 +186,7 @@ curl -X POST "http://localhost:8080/api/submit" \
|
||||
- canonical submission payload
|
||||
- normalized general search text
|
||||
- normalized CPU brand text
|
||||
- Searches scan the in-memory ordered slice rather than reopening and deserializing Badger values for every request.
|
||||
- Searches scan the in-memory ordered slice rather than reopening and deserializing Badger values for every request, and apply explicit platform, thread-mode, intensity, and duration filters in memory.
|
||||
|
||||
## Docker
|
||||
|
||||
|
||||
Reference in New Issue
Block a user