diff --git a/EnableSaveSearchFeature.md b/EnableSaveSearchFeature.md new file mode 100644 index 0000000..e4bc018 --- /dev/null +++ b/EnableSaveSearchFeature.md @@ -0,0 +1,77 @@ +# Save searches + +Save search feature allows you to save your search (including any filters that are applied) which can later be revisited by clicking on the saved search title. This feature is disabled by default. + + +## How to enable save search +You can turn on the save search option by passing in an additional prop to SearchBar component, this prop is called _allowSavedSearch_. For example: +``` + +``` +This would show a heart icon with a drop down next to the Search Bar, which means the UI component for saved search is enabled. +> **Note:** In order to make this feature work, we need to create a new zone to store the saved searches. This feature will **NOT** work if you haven't configured and specified a new zone for saved searches. + +## Configuring a new zone to store the saved searches +*Follow these steps to configure a new zone for storing the saved searches:* + + 1. Zones are configured via the [Index Feature](https://answers.attivio.com/display/extranet52/Configure+the+Index), in **[project-dir]\conf\features\core\Index.index.xml**. It should look similar to: + ``` + + + + + + + + + ``` + + 2. Edit this file to add in a new index zone. For example, we're creating a new index zone called *testZone* in the example below: + ``` + + + + + + + + + + + ``` +> If you don't configure any zones, there is always one zone named _default_. However, if you configure zones, you must explicitly configure the default zone in addition to the other zone. Additionally, you can also set up separate search workflows for these zones so you don't get the results from your *testZone* as a part of the search results. + +3. Configure the save search in SearchUI's configuration.properties file. You can specify the name of the new index zone for saved searches, the table name for all the documents for saved searches and the search workflow to be used for querying the mentioned zone. Below is an example with default values: + ``` + SearchBar: { + // configures the search workflow used for saved searches + savedSearchWorkflow: 'searchSavedSearches', + // configures the table name for saved searches + savedSearchTable: 'savedSearches', + // specifies the index zone for saved searches + savedSearchZone: 'savedSearches', + } + ``` + + +## How to use saved searches +After you enable and configure saved searches, you should have this component right next to the search bar: +![SavedSearch](https://user-images.githubusercontent.com/31805650/56602139-cdad5a00-65ca-11e9-9ee8-0744cc3de6cc.gif) + +### Saving a search +You can save searches by clicking on the first option in the drop-down menu 'SAVE SEARCH'. It will open up a modal that asks for the name for this search. +![Save a search](https://user-images.githubusercontent.com/31805650/56602446-7956aa00-65cb-11e9-975b-e5f2d1ee4ebc.gif) +> If you don't enter a name, the search term is used as the name. + +Click on save search button to save the search. + + +### Revisiting a search +You can revisit a search by clicking on the search title in the drop-down for saved search. +![Revisit a search](https://user-images.githubusercontent.com/31805650/56602470-8378a880-65cb-11e9-8e25-d04818424108.gif) + + +### Deleting a saved search +You can also delete a saved search, there's a **x** next to every saved search in the drop-down. Simply click on the **x** to delete a saved search. +![Delete a search](https://user-images.githubusercontent.com/31805650/56602482-8a072000-65cb-11e9-9821-7852ce27dfcb.gif) +> Note that the drop down only shows the 10 most recent saved searches. diff --git a/frontend/configuration.properties.js b/frontend/configuration.properties.js index dfc8e9a..a5f782e 100755 --- a/frontend/configuration.properties.js +++ b/frontend/configuration.properties.js @@ -240,6 +240,12 @@ // Whether to show a toggle for simple/advanced language in the search bar allowLanguageSelect: true, autoCompleteUri: '/rest/autocompleteApi/richCgi/dictionaryProvider', + // configures the search workflow used for saved searches, if empty the default search workflow is used + savedSearchWorkflow: '', + // configures the table name for saved searches + savedSearchTable: 'testTable', + // specifies the index zone for saved searches + savedSearchZone: 'testZone', }, // These properties configure the default properties for FacetSearchBar components in the UI. diff --git a/frontend/src/style/bootstrap/attivio-global-masthead.less b/frontend/src/style/bootstrap/attivio-global-masthead.less index 848ad2b..0c4e206 100755 --- a/frontend/src/style/bootstrap/attivio-global-masthead.less +++ b/frontend/src/style/bootstrap/attivio-global-masthead.less @@ -275,10 +275,22 @@ display: inline-block; } +.attivio-globalmast-search-saved-search { + position: relative; + /* max-width: 37.14285714286em; /* 520px /14 */ + width: ~"calc(100% - 100px)"; + max-width: 650px; + display: inline-block; +} + .attivio-globalmast-search .form-group .attivio-dropdown { width: 100%; } +.attivio-globalmast-search-saved-search .form-group .attivio-dropdown { + width: 100%; +} + .attivio-globalmast-search-container { display: table-cell; vertical-align: middle; @@ -367,6 +379,10 @@ margin: 0; } +.attivio-globalmast-search-saved-search .form-group { + margin: 0; +} + /* Secondary Navbar */ .attivio-globalmastnavbar { padding: 1.3rem; /* 13px /10 */