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/
Code Block |
---|
nano /opt/datafari/tomcat/webapps/Datafari/js/main.js |
And change the line :
Code Block |
---|
Manager.store.addByValue("fl", 'title,url,id,extension'); |
Add the field you want here, so in our example last_modified :
Code Block |
---|
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
Code Block |
---|
nano /opt/datafari/tomcat/webapps/Datafari/js/AjaxFranceLabs/widgets/SubClassResultWidget.js |
Add the display of your field in the code. For example if you want to add it after the URL of the document :
Code Block |
---|
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 :