Skip to content

Technical Documentation

Christian Gendreau edited this page Jun 19, 2015 · 14 revisions

This section includes documentation for developers who wants to modify the Explorer source code.

Filters definition

Types

The basic type of filters are defined in the SearchableFieldTypeEnum class of the liger-data-access project.

Options

The Explorer supports options on filters as defined in the class OccurrenceSearchableField

Suggestion support

This option allows filter to support autocomplete using the /ws/livesearch webservice.

Selection List support

This option allows filter value to be selected from a list of all possible values using the /ws/getpossiblevalues webservice.

Partial match support

This option allows filter value to use operator like 'starts with', 'contains' or 'ends with'.

How to add new filter

Prerequisites

  • Ensure the field you want to add a filter on is available in OccurrenceModel class.
  • Ensure this field is properly filled by lontra OccurrenceProcessor class.
  • If you plan your new filter to support option like 'Suggestion' or 'Selection List' the field must also be in the unique_values table. To add it see lontra ComputeUniqueValueTask.

Procedure

  • Add your new filter identification to SearchServiceConfig SearchableFieldEnum enum and assign an unused id.
  • Add your new filter to the SEARCHABLE_FIELD_MAP map of SearchServiceConfig constructor. The name your choose for your filter will now be referred as YOUR_FILTER_NAME.
  • OccurrenceSearchableFieldBuilder is used to build your new filter OccurrenceSearchableField object and indicate how it can be used: operators, link to database field, should it be choose from a list ...
  • Add the name to display for your filter in the language files (e.g. English file). Use the key filter.YOUR_FILTER_NAME in the property file.
  • Enable the filter in the search panel in the control.ftl file. Use the Freemarker variable availableFilters e.g. <option value="${page.availableFilters.YOUR_FILER_NAME}">${rc.getMessage("filter.YOUR_FILTER_NAME")}</option>.