Plugin: Enable empty queries

Other versions of this plugin may exist. Please ensure you are viewing the documentation for the version that you are currently using. If you are not running the latest version of your plugin we recommend upgrading. See: list of all available versions of this plugin.

Purpose

This plugin provides the ability to set a default query when a search is submitted with no query set. A common scenario the user wants to search for content by something other than relevancy.

For example:

  • Viewing all recent events and upcoming events.

  • Browsing a directory of services on a local council page.

  • Exploring a list of all available courses offered by a university or college.

The plugin works by injecting a query which returns all results. The default is !FunDoesNotExist:padrenull.

Usage

Enabling the plugin

The extra search functionality provided by this plugin requires that a tab is explicitly selected. It is highly recommended to specify a default tab by using the tabs-set-default plugin

Enable the query-set-default plugin on your results page from the Extensions screen in the administration dashboard or add the following results page configuration to enable the plugin.

plugin.query-set-default.enabled=true
plugin.query-set-default.version=1.0.0
The plugin will take effect as soon as it is enabled.

Configuration

The following settings must be added to the results page configuration to configure the plugin:

  • plugin.query-set-default.config.default_query: Specifies the query which is to be used when no query is provided. The default which runs returns all documents (!FunDoesNotExist:padrenull)

The default query makes use of the negation operator as a means to return all results. i.e. The default value of !FunDoesNotExist:padrenull translates to "Return all documents which does not have the metadata class FunDoesNotExist containing the word padrenull". As this is unlikely to be present in any document, all documents are returned.

Configuration

Show all results after a particular date

Funnelback supports various query operators which all can be used as part of the default query. The following configuration demonstrates how to set the default query to return all results after 1 Jan 2021:

The default query makes use of the negation operator as a means to return all results. i.e. The default value of !FunDoesNotExist:padrenull translates to "Return all documents which does not have the metadata class FunDoesNotExist containing the word padrenull". As this is unlikely to be present in any document, all documents are returned.

All versions of query-set-default