Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Current »

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.js

And 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.js

Add 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 :






  • No labels