Skip to content
Draft
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions implementing-nosto/implement-search/search/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -388,4 +388,23 @@ Tracking product clicks is fundamental for understanding user interaction. Use `

In case of an SPA based integration the `api.recordSearchClick` calls should be complemented with Session API or `api.createRecommendationRequest()` usage to couple the search analytics events to generic Nosto events for accurate attribution.

## Fallback mechanism

For JS API integrations, there is no built-in fallback functionality. Merchants need to build this themselves to ensure a robust search experience.

### When to implement fallbacks

You should implement fallback mechanisms in the following scenarios:

* **Search query errors**: When the search API returns an error response
* **Timeout scenarios**: When the search query takes longer than 1 second to return results

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mention that JS API based Search requests timeout after 5 seconds

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the timeout scenario to mention that JS API based Search requests timeout after 5 seconds as requested. The line now provides accurate information about the actual API timeout behavior. Changes committed in b9c4f21.

* **Network connectivity issues**: When there are network problems preventing API calls

### Implementation considerations

* **Error handling**: Always wrap Nosto search calls in try-catch blocks
* **Timeout management**: Implement reasonable timeout values (recommended: 1 second)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop this line

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped the timeout management line as requested. The bullet point about "recommended: 1 second" has been removed from Implementation considerations. Changes committed in b9c4f21.

* **User experience**: Ensure seamless transition to fallback without visible errors
* **Analytics**: Track fallback usage to monitor search performance

***