Text search
This is the widget's main flow: the user types in natural language, the backend runs semantic search + conversational ranking, and the widget renders the results with guided filters, AI response and top products.
How it works
- The user types in the
SearchInputcomponent. The input is a<textarea>(not<input>) to allow long, multi-line queries. - On Enter or submit, the widget calls:
GET /api/widget/search?q=…when no cart is wired in.POST /api/widget/searchwith a JSON body whencart.enabled = true(includescartContext).
- The
SearchResponseis applied to theWidgetContextand the results grid, guided filters, top products and AI response are rendered.
Defined at
WidgetSearchController.java:73(GET) andWidgetSearchController.java:114(POST).
Endpoint
GET
/api/widget/search# Query parameter is "q" (not "query"). limit defaults to 10, max 50.
curl "https://api.neuroon.ai/api/widget/search?q=running%20shoes&limit=10" \
-H "X-Widget-Token: $WIDGET_TOKEN"
POST
/api/widget/searchcurl -X POST https://api.neuroon.ai/api/widget/search \
-H "X-Widget-Token: $WIDGET_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"query": "running shoes",
"limit": 10,
"filters": { "categories": ["sports"], "priceMin": 50, "priceMax": 200 },
"cartContext": { /* … */ }
}'
POST uses
queryandcartContextin the body (SearchRequestDTO.java:25); GET uses?q=(WidgetSearchController.java:74).limitdefaults to 10, maximum 50.
Response
SearchResponse (SearchResponseDTO):
| Field | Description |
|---|---|
guidedFilters | Dynamic question cards generated by the AI. |
aiResponse | AIResponseBox with the conversational answer. |
topProducts | Highlighted carousel at the top of the results page. |
clarification, buyersGuide, kit, followUp, comparison, recommendations | Components specific to each turn type. |
cartAction, quickReplies | Cart-aware actions and quick reply chips. |
Input behavior
- Ghost text — inline suggestion (Tab to accept). Computed from the last result of the
/api/widget/suggestendpoint (notsuggestions). See features/suggestions. - Debounce — the suggestions dropdown debounces ~300 ms.
- Mobile — minimum
font-size: 16pxto avoid iOS auto-zoom.
No persistent state
Each init() starts with a fresh searchLogId. If you need continuity across pages (so the widget remembers the conversation), the backend already emits a conversationId on SearchResponse that the widget reuses on subsequent requests while the session is alive.
Further reading
- Suggestions — difference between
suggestionsandsuggest. - AI assistant — how the conversational response is composed.
- Reference → Data models — full
SearchResponse.