Add Direct Links feature into Datafari
The direct links feature is not integrated by default into Datafari. You have to activate it by doing few steps that we will explain here.
The direct link feature allows the user to display a graphical widget related to his query.
To activate it, you have to do modifications into Datafari, Solr and activate the widget into DatafariUI.
1.Datafari part
First you have to authorize a new search handler into the datafari.properties file. So edit the file :
nano $DATAFARI_HOME/tomcat/conf/datafari.properties
And add /select_directlinks into the userAllowedHandlers property :
userAllowedHandlers=/select_directlinks
You need to restart Datafari :
cd $DATAFARI_HOME/bin
bash restart-datafari.sh
Solr part
Add fields into the schema
To do that, you need to edit the file custom_fields.incl into $DATAFARI_HOME/solr/solrcloud/FileShare/conf/customs_schema :
And add :
Then you need to send the modifications the changes to Solr by executing the script addCustomSchemaInfo.sh into the same folder :
We did the modifications on the schema we can now do the modifications into solrconfig.
Add the configuration of a new handler
Edit the file custom_search_handler.incl into $DATAFARI_HOME/solr/solrcloud/FileShare/conf/customs_solrconfig :
And add this handler :
You can customize the configuration if you need to.
Modify the main search handler configuration (/select) :
– Comment or Delete the /select configuration into solrconfig.xml located into $DATAFARI_HOME/solr/solrcloud/FileShare/conf
Copy all the /select handler section into the file and comment it or delete it :
– Copy the select handler configuration that you just commented or deleted and paste it into the file custom_search_handler.incl located into $DATAFARI_HOME/solr/solrcloud/FileShare/conf/customs_solrconfig :
– Do a change into this configuration before saving the file :
You need to add a fq line into appends section of the file :
So all the section is like that :
This is now the entire file :
We have now to push this configuration to Solr, for this use the Datafari admin UI :
- Go to Search Engine Configuration → System Configuration Manager
Then click into Push button then Apply button :
– Check the Solr admin UI to see if there are any errors :
Go to Solr admin UI then into Logging menu :
If all seems correct, we can add some data now !
Add some data for direct links
The easiest is to use CSV format. Create a CSV file with the data and upload it to Solr.
– Create the CSV file
Create the file whereever you want into the Datafari server. In our example it will be into /var/datafari :
This is an example of data :
– Then send it to Solr :
You need to adapt the Solr URL if you are into multiservers mode into Datafari EE.
DatafariUI part
It is the simplest part, you just have to activate the widget into your ui-config.json file located into $DATAFARI_HOME/www/ :
And change the property show to true instead of false for the direct links widget :
And voilà ! Your widget should be displayed into your Datafari UI now :