Search Filters

Each user group can have a 'search filter' set (via the user group options in System Setup), which allows for resource visibility restrictions.

Filter configuration (post v9.0)

PLEASE NOTE: This requires the following configuration setting to be set. Once this configuration has been enabled it should not be disabled again or any filter changes made in the interim will be lost.

$search_filter_nodes=true;

Migrating legacy filters

  • If the configuration is enabled at the time of upgrading to 9.0 all filters will be automatically updated.
  • If the configuration is enabled after upgrading to version 9.0 then the filter configured for each group will be updated as members of that group access the system
  • To update all the filters immediately you can run the following script on your server
    upgrade/scripts/003_migrate_search_filters.php

Creating and editing filters

Navigate to System > Admin > Manage Filters, from here you can choose to create a new filter or edit an existing filter.

On the 'Edit filter' page you can rename your filter, configure the filter criteria and add/remove rules

Filter nameHere you can enter a user friendly name of your filter. Migrated filters will have the text of the original filter but can safely be renamed
CriteriaChoose whether ALL, ANY or NONE of the rules must apply for the filter to allow access
Filter rulesThis shows all rules set for the filter. Rules can be deleted by clicking on the 'x' to the right of the filter
Add filterClick here to add a new rule to the filter
DeleteCheck this box and then click the Save button to delete the filter.
If the filter is currently in use, deletion will be prevented and a notice will appear indicating which groups/users are using the filter

Adding filter rules

To add a filter rule, follow these steps:-

  1. Select the field you wish the rule to check. The dropdown box 'Select some options' will then be populated with the relevant field options
  2. Select whether the resources must have one of the chosen options set ('IS') or must not have any of the options set ('IS NOT')
  3. Select the desired field options. For large lists you can narrow down the list by starting to type the name of the option
  4. To add more rule conditions, click on the plus sign labelled 'Add condition'
  5. Once you have finished click the 'Add filter rule' button

Enabling a filter for a user group

To add a filter to a group, navigate to Admin > System > Manage user groups. Click on the group you wish to edit and select the required filter under the 'Search filter' option, located in the 'Advanced options' section.

Enabling a search override for a user

To add a filter to a user navigate to Admin > Manage users. Click on the user you wish to edit and choose the required filter option in the 'Search filter override' dropdown selector.

Filter configuration (pre v9.0)

You use the Shorthand name which is required for indexing fields and then this filter is always applied when that user is searching for resources. The generic syntax is as follows: {shortname(s)}{operation}{value(s)}[;{shortname(s)}{operation}{value(s)}]

For multilingual field options, the full i18n syntax string (e.g. ~en:Red~fr:Rouge) must be used here instead of a translated option.

The different operations work as follows:

Equals (=)(Equals Character)

country=Albania

You can only see resources that have a country value of "Albania"

Or (|)(Pipe character)

country=Albania|Brazil

The user will see resources where the country is Albania OR Brazil.

Not (!=)(Exclamation Mark and Equals Characters combined)

You can inverse the equals so that rather than checking if it is equal to a whole list of countries but not Albania, you can just specify NOT Albania.

country!=Albania

The user will see any resources that do NOT have the country value set to Albania. Multiple keywords can be specified here too using the same Or syntax.

Multiple Matches

Multiple matches can be achieved by seperating each statement with a ';' symbol. Both statements must match the given values and they are applied in the order that they appear i.e. the first statement runs first.

country=Albania;emotion=Happy

The user can only see happy photos from Albania.

And Or Combination

AND and ORs can be combined and in this case the OR is performed first:

country=Albania|Brazil;emotion=Happy

The user will see resources where the country is Albania OR Brazil, AND the emotion is Happy.

Or Multiple Fields

It is possible to implement OR matching across multiple fields, by using the Or sign in the left hand also. For example:

country|emotion=Albania|Brazil|Happy

This means either the country or emotion fields must contain any of the values of Albania, Brazil or Happy.