Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suit-issue-108: Adds configuration options and documentation for Saved Search #76

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
77 changes: 77 additions & 0 deletions EnableSaveSearchFeature.md
Original file line number Diff line number Diff line change
@@ -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:
```
<SearchBar allowSavedSearch />
```
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:
```
<?xml version="1.0" encoding="UTF-8"?>

<ff:features xmlns:ff="http://www.attivio.com/configuration/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fbase="http://www.attivio.com/configuration/features/base" xmlns:f="http://www.attivio.com/configuration/features/core" xsi:schemaLocation="http://www.attivio.com/configuration/config http://www.attivio.com/configuration/config.xsd http://www.attivio.com/configuration/features/base http://www.attivio.com/configuration/features/baseFeatures.xsd http://www.attivio.com/configuration/features/core http://www.attivio.com/configuration/features/coreFeatures.xsd">
<f:index enabled="true" name="index" profile="true">
<f:partitionSet size="1"/>
<f:writer logCommits="true" nodeset="ingestion" search="true"/>
</f:index>
</ff:features>
```

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:
```
<?xml version="1.0" encoding="UTF-8"?>

<ff:features xmlns:ff="http://www.attivio.com/configuration/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fbase="http://www.attivio.com/configuration/features/base" xmlns:f="http://www.attivio.com/configuration/features/core" xsi:schemaLocation="http://www.attivio.com/configuration/config http://www.attivio.com/configuration/config.xsd http://www.attivio.com/configuration/features/base http://www.attivio.com/configuration/features/baseFeatures.xsd http://www.attivio.com/configuration/features/core http://www.attivio.com/configuration/features/coreFeatures.xsd">
<f:index enabled="true" name="index" profile="true">
<f:writer defaultZoneName="default" logCommits="true" nodeset="ingestion" search="true">
<f:zone name="default" />
<f:zone name="testZone" />
</f:writer>
</f:index>
</ff:features>
```
> 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.
6 changes: 6 additions & 0 deletions frontend/configuration.properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 16 additions & 0 deletions frontend/src/style/bootstrap/attivio-global-masthead.less
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -367,6 +379,10 @@
margin: 0;
}

.attivio-globalmast-search-saved-search .form-group {
margin: 0;
}

/* Secondary Navbar */
.attivio-globalmastnavbar {
padding: 1.3rem; /* 13px /10 */
Expand Down