Typesense v1#83
Conversation
📝 WalkthroughWalkthroughAdds a Typesense v1 plugin with search-only configuration, validation, document, multi-search, and summary data streams, response-processing scripts, documentation, and a default Overview dashboard. ChangesTypesense v1 integration
Sequence Diagram(s)sequenceDiagram
participant Dashboard
participant DataStream
participant TypesenseAPI
participant PostRequestScript
Dashboard->>DataStream: Request search data
DataStream->>TypesenseAPI: Send configured HTTP request
TypesenseAPI-->>PostRequestScript: Return search response
PostRequestScript-->>Dashboard: Return flattened rows or summary metadata
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
🧩 Plugin PR Summary📦 Modified Plugins
📋 Results
🔍 Validation Details✅
|
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@plugins/Typesense/v1/dataStreams/documentSearch.json`:
- Around line 11-15: Require a non-empty query_by whenever q is not "*", while
preserving wildcard searches without query_by, in the request parameter mappings
for plugins/Typesense/v1/dataStreams/documentSearch.json lines 11-15 and
plugins/Typesense/v1/dataStreams/searchSummary.json lines 11-14; update both
streams consistently so invalid Typesense requests cannot be produced.
In `@plugins/Typesense/v1/dataStreams/scripts/multiSearch.js`:
- Around line 5-6: Update the _search assignment in the multi-search result
mapping to use 1-based numbering by assigning i + 1, so the first search is
displayed as Search `#1` while preserving the existing result mapping.
In `@plugins/Typesense/v1/docs/README.md`:
- Around line 21-33: Update the two setup examples in the README to use bash
language identifiers on their fenced code blocks and add blank lines immediately
before and after each fence. Preserve the existing curl commands and surrounding
setup text.
In `@plugins/Typesense/v1/ui.json`:
- Around line 13-18: Update the URL pattern in the validation configuration to
accept only https:// Typesense host URLs, while preserving the existing
host-only and no-trailing-slash/path constraints. Keep the validation message
aligned with the HTTPS-only requirement.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: 30ec68aa-4563-480f-837b-3a4fa3b57e05
⛔ Files ignored due to path filters (1)
plugins/Typesense/v1/icon.svgis excluded by!**/*.svg
📒 Files selected for processing (14)
plugins/Typesense/v1/configValidation.jsonplugins/Typesense/v1/dataStreams/documentSearch.jsonplugins/Typesense/v1/dataStreams/multiSearch.jsonplugins/Typesense/v1/dataStreams/scripts/documentSearch.jsplugins/Typesense/v1/dataStreams/scripts/multiSearch.jsplugins/Typesense/v1/dataStreams/scripts/searchSummary.jsplugins/Typesense/v1/dataStreams/searchSummary.jsonplugins/Typesense/v1/dataStreams/searchValidation.jsonplugins/Typesense/v1/defaultContent/manifest.jsonplugins/Typesense/v1/defaultContent/overviewDashboard.dash.jsonplugins/Typesense/v1/defaultContent/scopes.jsonplugins/Typesense/v1/docs/README.mdplugins/Typesense/v1/metadata.jsonplugins/Typesense/v1/ui.json
| { "key": "q", "value": "{{q || '*'}}" }, | ||
| { "key": "query_by", "value": "{{query_by || null}}" }, | ||
| { "key": "filter_by", "value": "{{filter_by || null}}" }, | ||
| { "key": "sort_by", "value": "{{sort_by || null}}" }, | ||
| { "key": "per_page", "value": "{{per_page || 50}}" } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '--- files ---\n'
git ls-files 'plugins/Typesense/v1/dataStreams/*.json'
printf '\n--- relevant snippets ---\n'
for f in plugins/Typesense/v1/dataStreams/documentSearch.json plugins/Typesense/v1/dataStreams/searchSummary.json; do
echo "FILE: $f"
nl -ba "$f" | sed -n '1,120p'
echo
done
printf '\n--- search for query_by validation / docs references ---\n'
rg -n '"query_by"|query_by|filter_by|q != "\*"' plugins/Typesense/v1 -g '*.json' -g '*.md' -g '*.ts' -g '*.js'Repository: squaredup/plugins
Length of output: 246
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '--- file sizes ---\n'
wc -l plugins/Typesense/v1/dataStreams/documentSearch.json plugins/Typesense/v1/dataStreams/searchSummary.json
printf '\n--- surrounding content: documentSearch.json ---\n'
sed -n '1,120p' plugins/Typesense/v1/dataStreams/documentSearch.json | nl -ba
printf '\n--- surrounding content: searchSummary.json ---\n'
sed -n '1,120p' plugins/Typesense/v1/dataStreams/searchSummary.json | nl -ba
printf '\n--- query_by references ---\n'
rg -n '"query_by"|query_by|filter_by|q' plugins/Typesense/v1 -g '*.json'Repository: squaredup/plugins
Length of output: 246
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Focus on the two stream files and nearby plugin metadata.
printf '--- plugin tree ---\n'
find plugins/Typesense -maxdepth 3 -type f | sort
printf '\n--- documentSearch.json ---\n'
cat -n plugins/Typesense/v1/dataStreams/documentSearch.json | sed -n '1,120p'
printf '\n--- searchSummary.json ---\n'
cat -n plugins/Typesense/v1/dataStreams/searchSummary.json | sed -n '1,120p'
printf '\n--- metadata/version files ---\n'
cat -n plugins/Typesense/v1/metadata.json 2>/dev/null || trueRepository: squaredup/plugins
Length of output: 246
🌐 Web query:
Typesense search API q wildcard query_by required documentation
💡 Result:
In the Typesense Search API, both the 'q' and 'query_by' parameters are required [1][2][3]. The 'q' parameter accepts the text you wish to search for [1][4]. To perform a wildcard search that returns all documents (typically used in combination with filters), you should set 'q' to '*' [1][2]. The 'query_by' parameter is used to specify one or more field names that Typesense should query against [1][2]. You can provide multiple fields by separating them with a comma (e.g., 'field1,field2') [1][2]. The order of these fields determines relevance, where matches in earlier fields are ranked higher than those in later fields [1][2]. Only string and string array fields are supported for full-text search in this parameter [1][2].
Citations:
- 1: https://typesense.org/docs/30.2/api/search.html
- 2: https://typesense.org/docs/30.2/api/search.md
- 3: https://typesense.org/docs/30.1/api/search.html
- 4: https://typesense.org/docs/guide/faqs.html
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Look for the same pattern in other Typesense stream definitions.
rg -n '"key": "query_by"|query_by.*required|required.*query_by|q.*\*' plugins/Typesense -g '*.json' -g '*.md' | sed -n '1,200p'Repository: squaredup/plugins
Length of output: 2425
Require query_by for non-* searches
Both streams accept q values other than * while leaving query_by empty, which makes Typesense reject the request.
plugins/Typesense/v1/dataStreams/documentSearch.jsonplugins/Typesense/v1/dataStreams/searchSummary.json
📍 Affects 2 files
plugins/Typesense/v1/dataStreams/documentSearch.json#L11-L15(this comment)plugins/Typesense/v1/dataStreams/searchSummary.json#L11-L14
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@plugins/Typesense/v1/dataStreams/documentSearch.json` around lines 11 - 15,
Require a non-empty query_by whenever q is not "*", while preserving wildcard
searches without query_by, in the request parameter mappings for
plugins/Typesense/v1/dataStreams/documentSearch.json lines 11-15 and
plugins/Typesense/v1/dataStreams/searchSummary.json lines 11-14; update both
streams consistently so invalid Typesense requests cannot be produced.
| result = (data.results || []).flatMap((r, i) => | ||
| (r.hits || []).map((h) => ({ ...h.document, _search: i, _relevance: h.text_match }))); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Use 1-based search numbering.
multiSearch.json displays _search as “Search #”, but the script assigns zero-based i, so the first search appears as 0. Use i + 1, or rename the field to indicate that it is a zero-based index.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@plugins/Typesense/v1/dataStreams/scripts/multiSearch.js` around lines 5 - 6,
Update the _search assignment in the multi-search result mapping to use 1-based
numbering by assigning i + 1, so the first search is displayed as Search `#1`
while preserving the existing result mapping.
| ``` | ||
| curl "https://<host>/keys" \ | ||
| -X POST \ | ||
| -H "X-TYPESENSE-API-KEY: <ADMIN_KEY>" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{"description":"SquaredUp search key","actions":["documents:search"],"collections":["<your-collection>"]}' | ||
| ``` | ||
| - Copy the returned `value` — this is your search-only key. It is shown only once. | ||
| 4. Confirm the key works: | ||
| ``` | ||
| curl "https://<host>/collections/<your-collection>/documents/search?q=*&per_page=1" \ | ||
| -H "X-TYPESENSE-API-KEY: <SEARCH_KEY>" | ||
| ``` |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Make the setup code fences lint-clean.
The two fenced examples need bash language identifiers and blank lines before and after the fences. Markdownlint reports MD031 and MD040 for these lines.
Proposed formatting fix
- Using an admin key, call the [Create API Key](https://typesense.org/docs/latest/api/api-keys.html) endpoint with the `documents:search` action, scoped to the collection(s) you want to expose. Example:
+
- ```
+ ```bash
curl "https://<host>/keys" \
...
-d '{"description":"SquaredUp search key","actions":["documents:search"],"collections":["<your-collection>"]}'
- ```
+
...
4. Confirm the key works:
- ```
+
+ ```bash
curl "https://<host>/collections/<your-collection>/documents/search?q=*&per_page=1" \
-H "X-TYPESENSE-API-KEY: <SEARCH_KEY>"
- ```
+ 📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ``` | |
| curl "https://<host>/keys" \ | |
| -X POST \ | |
| -H "X-TYPESENSE-API-KEY: <ADMIN_KEY>" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{"description":"SquaredUp search key","actions":["documents:search"],"collections":["<your-collection>"]}' | |
| ``` | |
| - Copy the returned `value` — this is your search-only key. It is shown only once. | |
| 4. Confirm the key works: | |
| ``` | |
| curl "https://<host>/collections/<your-collection>/documents/search?q=*&per_page=1" \ | |
| -H "X-TYPESENSE-API-KEY: <SEARCH_KEY>" | |
| ``` |
🧰 Tools
🪛 markdownlint-cli2 (0.23.0)
[warning] 21-21: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 21-21: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 27-27: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 30-30: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 30-30: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 33-33: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@plugins/Typesense/v1/docs/README.md` around lines 21 - 33, Update the two
setup examples in the README to use bash language identifiers on their fenced
code blocks and add blank lines immediately before and after each fence.
Preserve the existing curl commands and surrounding setup text.
Source: Linters/SAST tools
| "validation": { | ||
| "required": true, | ||
| "pattern": { | ||
| "value": "^https?://[^\\s/]+$", | ||
| "message": "Enter the base URL including https:// and no trailing slash or path" | ||
| } |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n## Files\n'
git ls-files 'plugins/Typesense/v1/*' | sed 's#^`#-` #'
printf '\n## ui.json (excerpt)\n'
nl -ba plugins/Typesense/v1/ui.json | sed -n '1,120p'
printf '\n## metadata.json\n'
if [ -f plugins/Typesense/v1/metadata.json ]; then
nl -ba plugins/Typesense/v1/metadata.json | sed -n '1,200p'
fi
printf '\n## Search for Typesense host/url handling\n'
rg -n '"value": "\\^https\\?://|X-TYPESENSE-API-KEY|Typesense' plugins/Typesense -SRepository: squaredup/plugins
Length of output: 975
🏁 Script executed:
#!/bin/bash
set -euo pipefail
git ls-files 'plugins/Typesense/v1/*'Repository: squaredup/plugins
Length of output: 873
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n## ui.json\n'
sed -n '1,220p' plugins/Typesense/v1/ui.json
printf '\n## metadata.json\n'
sed -n '1,220p' plugins/Typesense/v1/metadata.json
printf '\n## docs/README.md (relevant mentions)\n'
rg -n 'http|https|api key|X-TYPESENSE-API-KEY|base URL|Typesense' plugins/Typesense/v1/docs/README.md -n -C 2
printf '\n## configValidation.json\n'
sed -n '1,220p' plugins/Typesense/v1/configValidation.jsonRepository: squaredup/plugins
Length of output: 5932
Require HTTPS for the Typesense host URL.
ui.json still accepts http://, but this connection sends X-TYPESENSE-API-KEY on every request. The help text and docs already describe an https:// base URL, so the validator should match that and reject plaintext HTTP.
Proposed fix
- "value": "^https?://[^\\s/]+$",
+ "value": "^https://[^\\s/]+$",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "validation": { | |
| "required": true, | |
| "pattern": { | |
| "value": "^https?://[^\\s/]+$", | |
| "message": "Enter the base URL including https:// and no trailing slash or path" | |
| } | |
| "validation": { | |
| "required": true, | |
| "pattern": { | |
| "value": "^https://[^\\s/]+$", | |
| "message": "Enter the base URL including https:// and no trailing slash or path" | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@plugins/Typesense/v1/ui.json` around lines 13 - 18, Update the URL pattern in
the validation configuration to accept only https:// Typesense host URLs, while
preserving the existing host-only and no-trailing-slash/path constraints. Keep
the validation message aligned with the HTTPS-only requirement.
🔌 Plugin overview
multi_searchJSON queries, and result-count summaries against a Typesense Cloud (or self-hosted) instance — without ever needing admin access to the cluster.documents:searchaction) sent in theX-TYPESENSE-API-KEYheader.🖼️ Plugin screenshots
Plugin configuration
To add: screenshot of the Host URL / Search API Key / Collection setup form.
Default dashboards
To add: screenshot of the Overview dashboard (Total Documents + Search Time KPIs, Documents table).
🧪 Testing
Every stream was built and tested against a live, authenticated tenant (region
dev) usingsquaredup test, against a real collection (companies-production-en-us, ~10,633 documents):q=*search against the configured collection returns200 OK; confirms host, key, and collection in one probe.documentSearch— returns one row per matching document with dynamic per-collection columns plus a relevance score; verified that unset optional params (query_by/filter_by/sort_by) are correctly dropped, and that relevance populates on real text queries.multiSearch— rawPOST /multi_searchfrom a JSON blob; verified the configured collection is auto-injected as a query-arg default, so a minimal{"searches":[{"q":"*"}]}blob queries the right collection with nothing extra.searchSummary— single count row (found/out_of/search_time_ms); verifiedper_page=0returns counts with zero hits transferred.squaredup validate --jsonpasses: 4 data streams, icon, UI config, config validation, and default content all present.collections:listneeds an admin key). This is a query-on-demand plugin with no imported objects (hence no perspectives).per_page); search is designed to return the most relevant results, not to bulk-export a collection.per_pageand field counts reasonable, or narrow withfilter_by.timeframes: false). To restrict by time, add afilter_byon a timestamp field.📚 Checklist
Summary by CodeRabbit