Skip to content

Commit

Permalink
integration/config: allow query param update to be disabled
Browse files Browse the repository at this point in the history
Change-Id: Ie7108ea6b651c9da40a227bf6223c703d2da9cf6
Reviewed-on: https://review.sajari.com/301
Reviewed-by: David Howden <[email protected]>
Tested-by: David Howden <[email protected]>
  • Loading branch information
Benjamin Hinchley authored and dhowden committed Jul 25, 2018
1 parent 3f7c612 commit 2bb968f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,14 @@ By default search boxes have instant enabled and use the pipeline specified by `
| :--------------- | :-------------------: | :--------------------------------------------------------------------------------- |
| project | `"<your project>"` | Project to search |
| collection | `"<your collection>"` | Collection to search |
| pipeline | `"website"` | Pipeline to query when pressing enter or clicking an autocompleted suggestion |
| instantPipeline | `"autocomplete"` | Pipeline to query when typing, set to `""` to disable |
| pipeline | `"website"` | Pipeline to query when pressing enter or clicking an autocompleted suggestion |
| instantPipeline | `"autocomplete"` | Pipeline to query when typing, set to `""` to disable |
| maxSuggestions | `"5"` | Sets how many autocomplete suggestions are shown in the box below the search input |
| inputPlaceholder | `"Search"` | Placeholder text in the search input box |
| inputAutoFocus | `false` | Focus the searc input html element on initialisation |
| values | _see table below_ | Configuration of the pipeline values |
| results | _see table below_ | Configuration for the search results |
| updateQueryStringParam | `true` | Sets whether to update the query param in the url |

**Values configuration**

Expand Down
22 changes: 16 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,14 @@ const initInline = (config, pub, sub) => {
instantValues.set({ q: values.get().q });
}

pipeline.listen(searchSentEvent, values => {
updateQueryStringParam(config.urlQueryParam || "q", values.q);
});
if (
config.updateQueryStringParam === true ||
config.updateQueryStringParam === undefined
) {
pipeline.listen(searchSentEvent, values => {
updateQueryStringParam(config.urlQueryParam || "q", values.q);
});
}

ReactDOM.render(
<Inline
Expand Down Expand Up @@ -418,9 +423,14 @@ const initOverlay = (config, pub, sub) => {
}
});

pipeline.listen(searchSentEvent, values => {
updateQueryStringParam(config.urlQueryParam || "q", values.q);
});
if (
config.updateQueryStringParam === true ||
config.updateQueryStringParam === undefined
) {
pipeline.listen(searchSentEvent, values => {
updateQueryStringParam(config.urlQueryParam || "q", values.q);
});
}

ReactDOM.render(
<Overlay
Expand Down

0 comments on commit 2bb968f

Please sign in to comment.