[DEPRECATED] Display existing fields in Datafari search UI
Deprecated from Datafari 6.2
Please refer to the DatafariUI User Interface documentation
Valid up to Datafari 6.1 with AjaxFranceLabs
Let's say we want to display the field last_modified in the search UI of Datafari
The field is already present in the Solr schema so we just need to display it in the UI.
1.Edit the file main.js located in /opt/datafari/tomcat/webapps/Datafari/js/
nano /opt/datafari/tomcat/webapps/Datafari/js/main.jsAnd change the line :
Manager.store.addByValue("fl", 'title,url,id,extension'); Add the field you want here, so in our example last_modified :
Manager.store.addByValue("fl", 'title,url,id,extension, last_modified');2. We now have to edit the file SubClassResultWidget.js : /opt/datafari/tomcat/webapps/Datafari/js/AjaxFranceLabs/widgets/SubClassResultWidget.js
nano /opt/datafari/tomcat/webapps/Datafari/js/AjaxFranceLabs/widgets/SubClassResultWidget.jsAdd the display of your field in the code. For example if you want to add it after the URL of the document :
elm.find('.doc:last .address').append('<span>' + AjaxFranceLabs.tinyUrl(decodeURIComponent(url)) + '</span>')
elm.find('.doc:last .address').append('<div id="lastmodified">' + doc.last_modified );And finally your Datafari UI should be like that with the field last_modified at the end of each document :