Ajaxfrancelabs is deprecated as of Datafari v6.0 aside from specific admin and search expert functionalities. Please refer to DatafariUI for any search UI related task.

DateSelectorFacet module

A module creating a <div> element into the provided element of his constructor, containing two text inputs with their labels, which implement the  Datepicker widget from JQuery UI framework. One input represents a 'From' value and the other one represents a 'To' value. The combination of both values allows the user to select a range of dates. The module then provides a method that returns the range of dates as a string that is formatted as a Solr query filter: (fieldname):[(fromValue) TO (toValue)]. The used fieldname used in the Solr query filter is based on the 'field' parameter provided to the module instance.

The created div looks like this:

Prerequisites

In order to retrieve a proper Solr query filter value from the method getFilter(), the 'field' parameter of the module instance must be set with a valid Solr field name which is of date type !

Variables

Methods


SearchBar widget

A widget displaying a search bar and search options.

It contains a link useful to switch to advanced search (if that widget is activated): : in this case a default query is performed and the inputs and URL reset.

Variables

Methods

Note that the Autocomplete widget is also an extension of the Autocomplete plugin from jQuery UI and so it has all its variables and methods too.


Result widget

A widget displaying the search result.

Variables

Methods


 SubClassResult widget

A widget that implements Datafari specific code and parameters the Result widget. We did not test this widget towards a direct Solr system. This widget displays the search result. It displays results differently depending on the activation of the LikesAndFavorites widget.

Variables

Methods


ResultIllustrated widget

A widget that extend Result Widget and that displays image in result.

Variables

Methods


LikesAndFavorites Widget

Methods


SearchInformation widget

A widget displaying the search informations like the number of document found, the query execution time, ...

Methods


Table widget

A widget displaying a facet values in a table.

Variables

Methods


FacetDuplicates widget :

This widget displays duplicate documents that are in the index. It is very specific, not recommended for instance if you have an ecommerce website. It is more useful in an intranet context, where you may be interested to know which documents are present several times in your repositories.

The class is of  type  « final ». For each hash of a given document, the widget retrieves the corresponding document name (the corresponding field name for the document name needs to be identified. By default in Datafari, it is title_en or title_fr). For more information, refer to the specific deduplication documentation.

Variables

Methods


HierarchicalFacet widget

A widget displaying a facet values in a hierarchical way. Available as of Datafari v2.2.

Prerequisites

In order to make this widget work, it is mandatory that the selected facet field represents a path tokenization where each value is prefixed by its depth level.
For example, the path '/home/france/labs' will be tokenized as this : 0/home, 1/home/france, 2/home/france/labs

The default field that is used by the widget is ‘urlHierarchy’. This field exists in the Solr index but it is not filled because the "tokenization" strongly dépends on the crawled source. It can be filled like in the above example during the indexation phase by modifying the DatafariUpdateProcessor.java class located in [DATAFARI_REPO]/datafari-updateprocessor/src/main/java/com/francelabs/datafari/updateprocessor/. In this class, a commented section of the code can be found, that is an example to fill this field, you can use it and adapt it. Once the modifications are done, generate the update processor jar with maven with the command ‘mvn install’ ( to run in the ‘[DATAFARI_REPO]/datafari-updateprocessor/’ folder) then shutdown Datafari, replace the current update processor located in '/opt/datafari/solr/solrcloud/FileShare/lib/custom/' by the new one and restart Datafari.
Finally perform a complete crawl of the repository on which you want to use this widget (must be a full crawl/re-crawl, not a delta one). 

Variables

Methods


PrevisualizeResult widget

A widget that extend Result Widget and that displays a preview window at mousover on the document.


Starting from Datafari 4.1 :

- By default,  the previsualize window displays the first 1000 characters of the content of the document.


Prerequisites

In order to make this widget work, you have to customize the content that you want in the window and to activate the widget.

To activate the widget :

Uncomment the line :

Manager.addWidget(new AjaxFranceLabs.PrevisualizeResultWidget());

Uncomment the lines :

<script type="text/javascript" src="js/AjaxFranceLabs/widgets/PrevisualizeResult.widget.js" charset="utf-8"></script>

and

<div id="previsualize"></div>

To customize the information displayed :

Go to datafari/WebContent/js/AjaxFranceLabs/widgets/PrevisualizeResult.widget.js and edit the line to display whatever you want instead of the ID of the document :

$($('.doc_list .previsualizetemplate')[index]).append('<div id="previsualizeid">ID : '+docs[index].id+' </div>' );

Methods


ExternalResult widget

A widget that allows to have a federated search in Datafari ie display results from another search engine (Solr, Sharepoint for example) and display below the normal results from Datafari.

Prerequisites

In order to make this widget work, you have to parse the response from your external datasource. 

To activate the widget :

Uncomment the line :

Manager.addWidget(new AjaxFranceLabs.ExternalResultWidget());

Uncomment the lines :

<script type="text/javascript" src="js/AjaxFranceLabs/widgets/ExternalResult.widget.js" charset="utf-8"></script>

and

<div id="external"></div>

to select the data to parse :

Edit the line :

var urldatasource = 'http://localhost:8080/Datafari/externaldata.json';

Change the url for the data you want to parse.  

Adapt the code in the file to parse the information that you want in the JSON file.

By default the code is adapted to parse the file externaldata.json. Adapt this section :

$.getJSON(urldatasource,querySolr, function(result){

			$.each(result.d.query.PrimaryQueryResult.RelevantResults.Table.Rows.results,
					function(j, docu) {
				var highlightingvalues = docu.Cells.results[10].Value;
				highlightingvalues = replaceAll(highlightingvalues,"<c0>","<span class='em'>");
				highlightingvalues = replaceAll(highlightingvalues,"</c0>","</span>");

				elm.find('.externalresults').append(
						'<div class="external sp'+ j +'"></div>');
				var extension = docu.Cells.results[17].Value;
				elm.find('.external:last').append(
						'<div class="externaltitle"><a class="externallinktitle" target="_blank" href="'+docu.Cells.results[6].Value+'">'+docu.Cells.results[3].Value+'</a>');
				elm.find('.external:last').append('<p class="externalhighlight">'+highlightingvalues);
				elm.find('.external:last').append('<p class="externalurl">'+docu.Cells.results[6].Value);

			})
});

We provide some example data into Datafari if you want to test it out of the box :

Methods


Table Facet Queries widget

A widget displaying facet queries in a table.

Variables


Spellcheck widget

A widget spellchecking a query string. (eg: can offer you to correct constellia in constellio).

This widget works with both basic and advanced search.

Note: this requires enabling a spellchecker component in the searchhandler of Solr (done in the xml config files), whether you use a pure Solr or a Constellio Solr.

Variables

There are no specific variables: only the ones inherited from AjaxFranceLabs.AbstractWidget.

Methods


AdvancedSearch widget - new version (v3.2 of Datafari and above)

A widget enabling you to specify on which fields to perform a search.

The result of the search query is spellchecked by SpellChecker widget (if that widget is activated).

It contains a link useful to switch to basic search (if that widget is activated): in this case a default query is performed and the inputs and URL reset.

The AdvancedSearch widget is built with one other classe:

Variables

External variables

The advanced search widget is using external variables defined in the advanced-search.properties file located in DATAFARI_HOME/tomcat/conf
Here are the available variables in this file:

Methods

AdvancedSearchField

Extends AjaxFranceLabs.Class

Variables

Methods


AdvancedSearch widget (before v3.2 of Datafari)

A widget enabling you to specify on which fields to perform a search.

The result of the search query is spellchecked by SpellChecker widget (if that widget is activated).

It contains a link useful to switch to basic search (if that widget is activated): in this case a default query is performed and the inputs and URL reset.

By default the AdvancedSearch is desactivated from the splash page.

The AdvancedSearch widget is built with 2 other classes:

Variables

Methods

AdvancedSearchTable

Extends AjaxFranceLabs.Class

Variables

Methods

AdvancedSearchField

Extends AjaxFranceLabs.Class

Variables

Methods

Information about dynamic query composition:

Since on Solr side we store the title and content on separated fields based on the detected language, the query in input is then translated into the logic OR between the Solr fields that are functionally the same thus having language specialization: 
E.g.: content:datafari =>  (content_fr:datafari) OR (content_en:datafari) OR (content_it:datafari) OR (...).

Then every "expanded" logical term is composed with the other "expanded" search terms by means of the radio buttons.

Please note that the query expansion based on languages is dynamic and it's based on the available languages array in i18n variable. 

How to add a new field:

You need create a new field object and add it to the table object, as follows:
in createAdvancedSearchTable function of both search.js 

Add new field to advanced search
// Table is already created
 
var ast = new new AjaxFranceLabs.AdvancedSearchTable({ ... });

// Add your field NEW_FIELD
 
var asf = new AjaxFranceLabs.AdvancedSearchField({
		parent : '#advancedSearchTable',
		label : window.i18n.msgStore['advancedSearch-NEW_FIELD-label'],
		description : window.i18n.msgStore['advancedSearch-NEW_FIELD-descr'],
		field : 'NEW_SOLR_FIELD'		
	});
	
ast.addField(asf);

Menu widget

A widget building a dropdown menu.

Variables

Methods


Slider widget (beta)

A widget that will help you to select values as range or min/max for a chosen field.

This widget uses the jQuery UI Slider plugin.

Variables

Methods


Suggest widget

A widget creating a result widget that proposes other suggested documents to your search query. The name may be misleading, this is not the suggest module for an autocomplete, it is rather for a "more like this" behavior.

Variables

Methods


OntologySuggestion widget

A widget creating a result widget that proposes the most popular parent and child label of all the results. The name may be misleading, this is not the suggest module for an autocomplete, it is rather for a "related subjects" behavior.

Prerequisites

In order to make this widget work, it is mandatory that the ontologyEnabled parameter of the 'datafari.properties' file is set to true, as the documents (at least a few of them) in the results have been enriched by the OntologyUpdateProcessor

Variables

Methods


Pager module

A module creating a pagination.

Variables

Methods


Autocomplete module

This module creates a list of suggestions when you type in an input field. Note: this requires enabling a suggest component as a requesthandler of Solr (done in the xml config files), in case you use a pure Solr. If you are using Constellio, this config is normally already activated in its Solr. For Constellio 1.3, it also requires a modification of the web service servlet in order to reach the Constellio autocomplete service. Contact us if you need help.

This module is also an extension of the jQuery UI Autocomplete plugin and also has all its parameters and methods.

Variables

Methods


Collection widget

A widget displaying your constellio's collections. Obviously, this widget works only for Constellio. Note that this requires that your manager was initialised with the array of Constellio collections. See AbstractManager.collections for that. Note also that it requires a modification of the Constellio 1.3 web service servlet. Contact us to know what to modify.

Methods

Capsule widget

A widget that gives you tips about your search. Does not work for Solr. Note that this only works for Constellio 1.3, with a modified web service in order to support the request.

Methods


Favorite documents and searches

A module adding the possibility to create a favorite system on your searches and documents. Does not work for Solr. Note that this only works for Constellio 1.3, with a modified web service in order to support the request.

Variables

Methods


LoginDatafariFormWidget

The widget containing the login to admin UI form.

The code of this widget has been migrated from embedded JS of login.jsp to a separate widget.

Variables

No specific variables for this widget, only the ones inherited from AjaxFranceLabs.AbstractWidget.

Methods


LoginDatafariLinksWidget

The widget containing the login to admin UI form.

The code of this widget has been migrated from embedded JS of index.jsp to a separate widget.

Variables

No specific variables for this widget, only the ones inherited from AjaxFranceLabs.AbstractWidget.

Methods


LanguageSelectorWidget

This widget enables the user to change the language of the UI, among the available ones.

When a language change is detected by the application, it gets reset and a new splash page is displayed.

To add a language, you need to add an option in the combo box (option DOM element of buildWidget).

Variables

No specific variables for this widget, only the ones inherited from AjaxFranceLabs.AbstractWidget.

Methods