Plugin: Enable empty queries

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.

Plugin configuration options

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.

Examples

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:

plugin.query-set-default.config.default-query=!padrenull d>1jan2021

© 2015- Squiz Pty Ltd