Search within all Content Type fields using: _all - Documentation topics on: _all,search in all fields,searching for content,.

Search within all Content Type fields using: _all

The _all search term keyword allows you to search within all searchable or indexed fields of a Content Type at once.

Example

The dotCMS starter site (and the dotCMS demo site) contain a News Content Type which has the following searchable or indexed fields:

  • Headline
  • Byline
  • Topic
  • Tags

Single Field Search

When you perform a search in the Content tab for News content with the word “gas” in the Headline field only, you receive only one result:

You can click on the Search button and then on Show Search Query to view the query used to perform the search:

Explicitly Searching Each Field

To write a standard query that includes all searchable fields, you must explicitly include both the field name and the search term for each field to be searched:

+contentType:News +(News.title:*gas* News.byline:*gas* News.topic:*gas* News.tags:*gas*)

Searching All Fields

You can simplify this by using the _all keyword as follows:

+contentType:News +_all:*gas*

Testing the Results

You can test the queries and verify that they produce the same results using the system Query Tool.

In the Query Tool, the original query (with each field referenced explicity) produces the following results:

The simplified query (using _all) produces the following results: