webapi search: Implement /search/result/ws

This commit is contained in:
Kleissner
2021-10-10 16:58:09 +02:00
parent 7891bdbeac
commit 7495b823e4
3 changed files with 47 additions and 10 deletions

View File

@@ -44,6 +44,7 @@ These are the functions provided by the API:
/search Submit a search request
/search/result Return search results
/search/result/ws Websocket to receive results
/search/terminate Terminate a search
/search/statistic Search result statistics
@@ -674,6 +675,18 @@ type SearchStatisticRecord struct {
}
```
### Receiving Search Results via Websocket
This provides a websocket to receive results as stream. It does not support changing runtime filters and returning statistics.
```
Request: GET /search/result/ws?id=[UUID]&limit=[optional max records]
Result: If successful, upgrades to a websocket and sends JSON structure SearchResult messages.
Limit is optional. Not used if ommitted or 0.
```
Example socket URL: `ws://127.0.0.1:112/search/result/ws?id=08ab3469-cd0e-4219-998f-bfdf496351eb`
### Terminating a Search
The user can terminate a search early using this function. This helps save system resources and should be considered best practice once a search is no longer needed (for example when the user closes the tab or window that shows the results).