Filters are what are used to reduce the result set of a View to a manageable amount of data. They are a critical part of the foundation of this system.
The filtering system is a compromise between flexibility and ease of use. To be truly powerful, filters should provide the ability to do an OR, but as it stands, these filters are all ANDed together. That means that every filter is applied. While the ability to do an OR would be nice, unfortunately the level of complexity in the interface to do that is well beyond the benefit that would be given.
The order of filters is irrelevant, though they can be re-ordered as a convenience.
- This is simply the field being filtered on.
- The operator tells Views HOW to filter, and is part of the 'equation' of a filter. Usually this appears as a human readable sentence, and by simply reading the fieldname, with the operator and the value, it is clear what the operator means. For example, "Taxonomy Term", "Is One Of", "...some list of selected terms...".
- The Value field varies greatly based upon what field is being filtered, but is usually either a text box or a select box.
- The option field is specific to each field being filtered. The only currently existing option is on taxonomy terms, where the taxonomy depth is listed as an option. For taxonomy filters, you cannot specify "all" as a depth but must specify a number. The correct number to use depends on your site, but 2 will get roughly 90% of the uses. 3 will work for roughly 99% of the cases. The more you set the more expensive the query so set it to the smallest number that will work for your situation.
- If a filter is 'exposed' the user will be presented with a widget to control the filter. When the expose button is clicked, the filter is added to the 'Exposed Filters' fieldset that appears just below the Filters.
Exposed filters are shown to the user, so that the result set can be modified. The typical example of this is to expose taxonomy as a filter so that the user can select which taxonomy term to filter on.
The order of the exposed filters controls the order in which they are presented to the user.
- This is the field being filtered; while all of the other fieldsets include an 'Add' button beneath it, this one does not; to add an exposed filter, go up to the Filters fieldset and click 'expose' on the filter you want exposed.
- This is the label presented to the user.
- If a filter is set optional, an "<All>" choice will be added (if it's a select). If a filter is not optional, a value must be provided to the view.
- Filter settings Default
- If a filter is set to optional, and this setting is checked, the actual settings of the filter will be the default; if this setting is not checked, the default will be set to blank or .
- Force Single
- If this setting is checked, any multi-select box available for this filter will be forced into a dropdown box and only one selection will be allowed. This is typical; dropdowns use less screen real estate and are easier for people to use.
- Lock Operator
- If this field is checked, the 'operator' will not be exposed, and the setting in the Filters section will be used. This setting is typical.
What follows is a list of filters that Views provides by default. Like other systems in Views, modules can provide more of these.
- Node: Has New Content
- Including this filter will reduce the node set to nodes that have been updated or have new content since the user last read the node, as well as unread nodes.
- Node: Published
- Filter by whether or not the node is published. This is recommended for most Views!
- Node: Front Page
- Filter by whether or not the node has been promoted to Front Page.
- Node: Sticky
- Filter by whether or not the node is set sticky.
- Node: Moderated
- Filter by whether or not the node is moderated.
- Node: Type
- Include or exclude nodes of the selected types.
- Node: Author is Anonymous
- This allows you to filter by whether or not the node author is anonymous.
- Node: Author is Current User
- This allows you to filter by whether or not the node was authored by the logged in user of the view.
- Node: Current User Authored or Commented
- This allows you to filter by whether or not the logged in user authored or commented on the node.
- Node: Distinct
- This filter ensures that each node may only be listed once, even if it matches multiple criteria. Use this if multiple taxonomy matches return duplicated nodes.
- Node: Author Name
- This allows you to filter by a particular user. You might not find this useful if you have a lot of users.
- Role: Author Role
- Include the node only if the author is a member of the selected role.
- Taxonomy: Term
- When filtering by taxonomy term you may specify the "depth" as an option. Please see the taxonomy help for more information.
- Taxonomy: Terms for a specific vocabulary
- Only terms associated with the specified will appear in the select box for this filter. When filtering by taxonomy term you may specify the 'depth' as an option. Please see the taxonomy help for more information.
- Taxonomy: Vocabulary Name
- This will filter a view to only nodes that contain a term in the associated vocabulary.