StaticSync

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

The creation of filters is described here.

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.