Access Keys:
Skip to content (Access Key - 0)

Search Query Syntax

Use the powerful query syntax to make searching more precise...

What is Query Syntax?

Normally, you search for content by simply entering a few keywords in order to list everything that contains one or more of those keywords. However, there are times when you need to be more specific and that's where the "query syntax" comes in to play. Query syntax allows you to create far more specific search criteria in order to make the search results more precise to your needs.

Query Terms

Query terms are the keywords that you wish to search for. There are two types of query term:

Single Term Phrases
One or more individual keywords to search for...

Examples:

  • Builder
  • Link Attachments

In the first example, any content containing the word Builder would be listed in the results. In the second example, any content containing one or both of the words (Link and/or Attachments) would be listed in the results.

Sequences of words, enclosed in quotes, to search for...

Examples:

  • "Link Attachments"
  • "The quick brown fox"

In both examples, the exact sequence of words must be found for the content to be listed in the results. For example, if a page contained both the words Link and Attachments but not next to each other, it would not be listed in the results.

Both types of query term are case insensitive. For example, entering Link would find the word link with any capitalisation such as Link, link, LINK and LiNk, etc.

Term Modifiers

Modifiers are used to give specific instructions to the search engine...

Wildcards

Wildcards can be used to match any character or group of characters within your search terms:

  • For a single character wildcard, use: ?
  • For a multiple character wildcard, use: *

The single character wildcard looks for terms that match with the single character replaced. For example, to search for text or test you can use the search:

te?t

Multiple character wildcard searches looks for 0 or more characters. For example, to search for Windows, Win95 or WindowsNT you can use the search:

win*

You can also use the wildcard searches in the middle of a term. For example, to search for Win95 or Windows95 you can use:

wi*95

You cannot, however, use wildcards at the start of your search terms, so "*ows" could not be used to find windows or cows, etc.

Sounds Similar

Normally, content will only be listed in the search results if it contains your search terms spelt exactly as you typed them.

You can use "fuzzy" searches to find words that sound similar to what you typed - this is ideal if you're not sure how something is spelt.

For example, to search for words that sound like roam, use:

roam~

Content containing words such as roam, foam and roams would be listed in the search results.

Specific Property

Normally, the search will include most if not all information contained within an object such as a page, user profile or email message. However, it's possible to restrict the search to a specific attribute such as the page title or author as follows:

title:link attachments

This would search for anything with a title that contains the words link and/or attachments.

Some other common properties are:

  • title - the title of the item
  • content - the main content of an item
  • creator - the username of the person who created the item
  • lastModifier - the username of the person who most recently updated the item
  • spacekey - the unique key for the space that the item is stored in
  • labelText - any lables attached to an item (Confluence 2.x and above)
  • classname - the fully-qualified class name of the items Java type (eg. com.atlassian.confluence.pages.Page)

Word Proximity

Normally, when you enter a search phrase, content will only be listed in the results if both words are found together:

"links attachments"

This would not list content that contained the phrase links and attachments because the word links is not next to attachments.

If you want to search for content where two words are within a certain distance of each other, use a proximity search:

"links attachments"~3

Which would find things like:

  • links attachments
  • links and attachments
  • links to your attachments
  • links for your file attachments

Term Importance

Normally, each search term has the same importance of 1. In our example earlier, content containing Link would be ranked no higher than content containing Attachments because both terms have the same importance.

If you are looking for content with multiple terms but want to prioritise results containing one of the terms, state the importance of the terms:

Link^3 Attachments

In this example, the word Link would be three times as important as the word ??Attachments".

You can prioritise each term if desired, for example:

"file attachments"^2 attachments

In this example, content containing the phrase file attachments would be twice as important as content that merely contains the word attachments.

Logic Conditions

You can add logic to your searches to filter out unwanted results, etc.

All logic operators must be entered in capital letters, for example "AND" instead of "and"...

OR

By default, terms are matched using the "OR" operator. For example:

link attachments

Is the same as typing:

link OR attachments

Content that contains the word link or attachments would be listed in the search results, as would content containing both words.

AND

If you want content to be listed only if both terms are present, use the AND operator:

link AND attachments

Only content that contains both the words link and attachments would be listed in the search results.

NOT

If you want to search for content that contains one or more terms but only if it does not contain another term, use the NOT operator:

link attachments NOT files

This example would list any content that contains the words link and/or attachments but only if it does not contain the word files.

Required Term

When searching for multiple terms, content will be listed in the search results if any of the terms are found.

However, you might want to indicate that one or more of your terms are mandatory, for example:

links attachments +images

The "+" before the word images indicates that that word must be found in order for the content to be listed in the search results. If any of the other words (links and/or attachments) are found, the content will get a higher ranking in the results.

Excluded Term

This is the opposite to a required term and allows you to remove content from the search results if it contains a keyword or phrase, for example:

-"link attachments" images

This example would list all content containing the word images as long as it does not contain the phrase link attachments.

Grouping

Just as you can use brackets in maths to group various parts of a calculation, you can group various parts of your search term. For example:

(link -attachments) OR (-link attachments)

This example would find content that contains the word link but not attachments OR content that contains the word attachments but not link.

(link OR attachments) AND files

This example would find content that contains the words link and/or attachments but only if the content also contains the word files.

Escaping Special Characters

There are several characters that have special meaning to the search engine. To search for these characters you have to tell the search engine to ignore their special meaning and this is done using a process known as "escaping".

The special characters are:

+ - && || ! ( ) { } [ ] ^ " ~ * ? : \ 

To escape such characters, put a backslash in front of them. For example, to search for (1+1):2 you would need to type:

\(1\+1\)\:2

Hints and Tips

You can mix various types of search term modifiers, for example:

title:foam~

Content with a title that sounds like "foam" would be listed in the search results.

Frequently Asked Questions

None at present

See Also



Ask questions, get help and report bugs & issues on our Community Site

View old comments


Adaptavist Theme Builder Powered by Atlassian Confluence