Save search - technical doc
Starting from Datafari 5.0, this is available also for the Community Edition
Since Datafari 3.2, this feature allows you to save a search. This feature is divided in four parts:Â
The UI: a new div element has been added to the file
WebContent/searchView.jsp
. The id of this div element is 'save_search
' and the div is only added when an authenticated user is detected to prevent unsupported access to the feature.The widget: the javascript of the widget that adds the search button and implements its behavior is located in
WebContent/js/AjaxFranceLabs/widgets/SaveSearch.widget.js
and is instanciated in the fileWebContent/js/search.js
. The widget javascript file needs also to be imported in the fileWebContent/searchView.jsp
. The widget function is to save all the parameters of the query performed by Solr, thanks to the manager.store object.The servlet: Once the user clicks on the "Save search" button, he needs to enter a name and validate. When the 'Validate' button is pushed, the widgets sends the chosen search name and the search infos (the query performed by Solr) to the servlet "
/saveSearch
". The servlet retrieve the query parameters, the name entered by the user and the username, and insert everything in the Cassandra database. The servlet java code is located insrc/main/java/com/francelabs/datafari/servlets/SaveSearch.java
The database table: The servlet insert the saved search data into the datatable "
search
" of the Datafari database of Cassandra. This table is created thanks to the scriptdatafari-cassandra/conf/dev-env/tables
and is composed of three fields:username
: the user namename
: the search name entered by the userrequest
: the Solr query parameters corresponding to the saved search