Building a Purple Experience
Components
Search Component
10min
this documentation provides a guide to the structure, functionality and configuration of a search page in the purple experience for your purple app and/or website it also provides some details on how to configure the display of search results, navigation or access fallback basic structure of a search page search field component publication type toggle list (search results) search field component the ' search field' component is the actual text box where the user enters the text when he confirms the search, a query parameter (default is 'phrase') is added to the url containing the searched text search is handled by an api that accepts a search term and returns results currently it's not possible to specify what fields are searched in the experience no type ahead possible search icon to trigger search, "x" to clean the input field a search box, that can be included on pages, allows users to search for specific content the search phrase is accessible via $context phrase the query parameter from the url is available in the context, so $context phrase gets replaced with the searched phrase after the user has entered something into the search bar and pressed 'search' search field component in views json publication type toggle the ' publication type toggle' component is where you can filter by which publication type you want to search this can later be used to filter the results or display the correct views based on the type the selection is accessible via $context publication type publication type toggle in views json list (accessing search results) the ' list' component is where the search results will be displayed for that, you are required to set the content to searchresult and the datasource to searchresultdatasource you can additionally show an individual styled search result for issues, posts and bundles by adding multiple views and use conditions bundles and dossiers are currently not fully supported, and we are still in the process of migrating the ' searchresult' component to fully support those the ' searchresult' component has a lot of customization options which are documented here issue search results config ts here is an example setup example setup for the list component conditionals you can use conditions to conditionally show components like 'no search results' or 'please enter a search phrase' or to display search results differently based on publication type here you can see an example some more examples are listed after the screenshot 'no search' example for a condition search header conditional examples not searched { "value" "$context phrase", "operation" "not set" } search title { "value" "$context phrase", "operation" "not empty" } search results conditional examples search results (news) { "and" \[ { "value" "$context phrase", "operation" "not empty" }, { "value" "$context publication type", "comparevalue" "channel" } ] } search results (epaper) { "and" \[ { "value" "$context phrase", "operation" "not empty" }, { "value" "$context publication type", "comparevalue" "kiosk" } ] } navigation for navigation configuration see the static routing docid\ yvk2ekejex9kmanjphtkz documentation fallback (a k a content access control ) this configuration defines what to do if the user is not allowed to access/view the content (i e not purchased) the most common actions here are navigateaction or popupaction the following example opens the content if the user has access otherwise shows the view "paywall" in a popup navigation example search results in issues if you search for issues / contents of type issue, you may configure the search results to display multiple results for the same issue if found to do so, you'll need to set up the pagehitlimit accordingly this defaults to 1 pagehits will open the page in the issue directly if the user is entitled accordingly if no valid entitlement for the content is present, the issue is opened according to its customer preview setup, on page 1