Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

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.

...

  • pagination: can take 3 values

    • false(default): no pagination.

    • true: pagination automaticaly created.

    • PagerWidget: a pager widget.

  • elmSelector: used to store the results to be displayed. Corresponds to the jQuery selector.   

  • firstTimeWayPoint: used in the mobile mode, to know when we reach the bottom of the page, to trigger the spinner in order to load and display the further results.

  • isMobile: checks whether we are in mobile mode or not.

  • mutex_locked : is a variable used as a mutex for the mobile mode

Methods

  • buildWidget: an implementation of the parent class method.

  • beforeRequest: an implementation of the parent class method.

  • afterRequest: an implementation of the parent class method.

...

Code Block
Manager.addWidget(new AjaxFranceLabs.PrevisualizeResultWidget());
  • in datafari/WebContent/searchView.jsp

...

Code Block
Manager.addWidget(new AjaxFranceLabs.ExternalResultWidget());
  • in datafari/WebContent/searchView.jsp

...

  • DENIEDFIELDLIST: list of Solr fields that you don't want to appear in the advanced search fields list. In this variable, fieldNames are separated by coma ( ex: DENIEDFIELDLIST=field1,field2,.... )

  • EXACTFIELDS: list of Solr fields that have associated exact fields in Solr. For each Solr field specified in this list, the advanceSearchWidget will use its associated exact field to perform exact expression search.
    In this variable, fieldNames are separated by coma ( ex: EXACTFIELDS=field1,field2,.... )
    As you cannot (for the moment) specify the name of the associated exact fields, the associated exact fields must respect the following naming rule for the advancedSearchWidget to be able to automaticaly use them : exact_fieldName

Methods

  • buildWidget: an implementation of the parent class method: builds the widget.

  • reinitVariables: cleans all the fields selected in the advanced search and their filters values

  • buildStartingUI: builds the advanced search UI according to the last executed query in the search UI. This function parses the last executed query in the standard search UI to build every required elements in the advanced search (the fields and their filters values)

  • extractFilterFromText: computes the values entered by the user for a specific field, in order to create the corresponding filters which can be processed as a query by Solr

  • addField: adds a new field and its filters elements to the advanced search UI

  • constructFilter: Method that constructs the proper filter UI corresponding to the field provided and the other parameters

  • beforeRequest: an implementation of the parent class method: builds the search query with the inputs from AdvancedSearchFields and calls updateAddressBar.

  • displayBasicSearch: hide the advanced search UI and displays the basic search UI

  • reset: an implementation of the parent class method: resets the inputs of the widget and calls the reset method on the underlying elements table and fields (useful when switching between basic and advanced search).

  • makeRequest: cleans the results area (list and facets) and performs a default search (*:*)

  • cleanResults: cleans the results area (list and facets)

  • updateAddressBar: updates the URL in the address bar with the advanced search query created by beforeRequest.

...

  • init: an init method, that creates the class.

  • getValue: a method returning the value of this field, after call to buildSearchTerm method.

  • reset: an implementation of the parent class method: resets the inputs of this class.

  • buildSearchTerm: expands the field's search term with the available languages: 
    e.g. content:giovanni becomes ((content_en:giovanni) OR (content_it:giovanni))

Information about dynamic query composition:

...

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

Add new field to advanced search

...

  • name: String - name of the widget that will appear as the title in the search view

  • field: String - the field name in the Solr core that will be used by the widget

  • fieldType: String - the type of the chosen field. Only two values are accepted by the widget, 'date' and 'numeric'. (notice that the lowercases matter)

  • elm: String - the id of the div in the search view that will contain the widget

  • range: Boolean - set to true if you want a slider with a range, false otherwise

  • min: Integer - the minimum value of the slider (also used as the default minimum value if the range slider has been selected). Can be negative

  • max: Interger - the maximum value of the slider (also used as the default maximum value if the range slider has been selected). Can be negative

  • unit: String - this field is only used when the fieldType has been set to 'date'. In that case you have three options 'YEAR', 'MONTH' or 'DAY'. When a date field type is used with this widget, the resulting Solr query filter that will be applied by the widget will be "(field):[NOW(+/-)(slider_value)(unit)]. So keep in mind that the slider will be based on the current date to create the query. For now we didn't have implemented a parameter to change this behavior   

  • defaultValue: Integer - only used when the slider is not in the 'range mode'. Default value when the widget is loaded for the first time

  • step: Integer - defines the number which represents the minimum step performed when the user slide

  • comparator: String - only used when the widget is not in the 'range mode'. Two possible values, 'greater' or 'less' (lowercases matter). When the widget is not in the 'range mode' you have the choice to define if the chosen field value must be greater than or less than the selected  one in the slider. For now we didn't have implemented the 'equal' comparator.

...

  • beforeRequest: an implementation of the parent class method.

  • afterRequest: an implementation of the parent class method.

  • removeFavoriteDocument: takes as parameter the id of the favorite document and a callback method.

  • removeFavoriteSearch: takes as parameter the id of the favorite search and a callback method.

  • removeSearchInHistory: takes as parameter the id of the search to remove in the history and a callback method.

  • getFavoriteDocuments: takes as parameter a callback function, the first element to start on and the number of elements to retrieve.

  • getFavoriteSearches: takes as parameter a callback function, the first element to start on and the number of elements to retrieve.

  • getSearchHistory: takes as parameter a callback function, the first element to start on and the number of elements to retrieve.

...

LoginDatafariFormWidget

The widget containing the login to admin UI form.

...