Searching Confluence - Advanced - Metadata With Lucene

This guide is currently still under development, some sections may be incomplete, please leave a comment if there is anything that is a bit confusing or if there are anything you wish to contribute to this guide.

Table of Contents

Description

This guide details the ways in which you can search Confluence based on the metadata of Confluence content, and is targeted for advanced users of Confluence who wish to extend the capabilities of the search system beyond the standard notations.

For normal usage of the Confluence searching system, please refer to the Atlassian documentation for the Confluence Search Syntax.
For a list of the currently available search fields, please refer to the Atlassian documentation for Confluence Search Fields.

Advanced Searching

General Syntax

The general syntax used for searching metadata is quite straight-forward, simply use the field name followed by a colon, then followed by the search criteria, which varies depending on the data type of what you are searching for (refer to Searchable Fields for more information about the searching data types and what fields are available.

Example
If you want to search for all content with the label "mylabel", then simply put the field key "labelText", then a colon, and the label, note that with labels, the search is case sensitive, so you have to put "mylabel".
labelText:mylabel

Searchable Fields

Content Types

Personal Information

Field Type Description
handle Exact Text The class name for the entity followed by the ID of the entity eg. com.atlassian.confluence.pages.Page-32579
type Content Type The content entity type
urlPath Free Text The URL path to the page from the context path of the Confluence instance
fullName Free Text The user's full name
username User The user's login name
title Free Text The title of the content
labelText Exact Text The displayable string representation for labels on the page
modified Date The date which the content was last modified
created Date The date which the content was created
userpermission    
contentBody Free Text The contents of the entity
email Exact Text The user's email
hasPersonalSpace Boolean Type Checks if the user has a personal space, one weird bug with this field is that instead of "false", you have to search for "falsee" to get the correct results

Pages

Field Type Description
handle Exact Text The class name for the entity followed by the ID of the entity eg. com.atlassian.confluence.pages.Page-32579
type Content Type The content entity type
urlPath Free Text The URL path to the page from the context path of the Confluence instance
title Free Text The title of the content
spacekey Exact Text The string representation of the key for the space
labelText Exact Text The displayable string representation for labels on the page
modified Date The date which the content was last modified
created Date The date which the content was created
userpermission    
contentBody Free Text The contents of the entity
lastModifiers User The username of the user who last modified the entity
creatorName User The username of the user who created the entity
watchers User The username of the person watching the page, note that this field is delimited so you pretty much can only find the FIRST person to watch that page using this method.

News

Field Type Description
handle Exact Text The class name for the entity followed by the ID of the entity eg. com.atlassian.confluence.pages.Page-32579
type Content Type The content entity type
urlPath Free Text The URL path to the page from the context path of the Confluence instance
title Free Text The title of the content
spacekey Exact Text The string representation of the key for the space
labelText Exact Text The displayable string representation for labels on the page
modified Date The date which the content was last modified
created Date The date which the content was created
userpermission    
contentBody Free Text The contents of the entity
lastModifiers User The username of the user who last modified the entity
creatorName User The username of the user who created the entity

Attachments

Field Type Description
handle Exact Text The class name for the entity followed by the ID of the entity eg. com.atlassian.confluence.pages.Page-32579
type Content Type The content entity type
urlPath Free Text The URL path to the page from the context path of the Confluence instance
filename Free Text The name of the file
file Free Text The name of the file
file.extension Exact Text The extension of the attachment
title Free Text The title of the content
comment Free Text The comment given to the attachment when attaching it
spacekey Exact Text The string representation of the key for the space
modified Date The date which the content was last modified
created Date The date which the content was created
userpermission    
contentBody Free Text The contents of the entity
filesize Sizes Type The size of the file in bytes

Mail Items

Field Type Description
handle Exact Text The class name for the entity followed by the ID of the entity eg. com.atlassian.confluence.pages.Page-32579
type Content Type The content entity type
urlPath Free Text The URL path to the page from the context path of the Confluence instance
title Free Text The title of the content
spacekey Exact Text The string representation of the key for the space
messageid    
inreplyto    
recipients    
labelText Exact Text The displayable string representation for labels on the page
modified Date The date which the content was last modified
created Date The date which the content was created
userpermission    
contentBody Free Text The contents of the entity
lastModifiers User The username of the user who last modified the entity
creatorName User The username of the user who created the entity

Comments

Field Type Description
containingPageId Exact Text The ID of the page that the comment is related to
lastModifiers User The username of the user who last modified the entity
creatorName User The username of the user who created the entity
spacekey Exact Text The string representation of the key for the space
contentBody Free Text The contents of the entity
modified Date The date which the content was last modified
created Date The date which the content was created
type Content Type The content entity type
handle Exact Text The class name for the entity followed by the ID of the entity eg. com.atlassian.confluence.pages.Page-32579

Searching Types

Basics

This applies to all search types, some characters have special meanings or are not allowed, for example * and ? are reserved for wildcard/branched searching and ~ (which is used in personal spaces) is not allowed, in these cases you will have to escape the character by preceding it with a backslash ()

Date Type

To search on date types, you MUST to use the Range Searching syntax, the date format in Confluence by default is: MM/dd/yy, if you want to obtain content for a SINGLE day, you will need to specify an inclusive ranged search where the start of the range is equal to the end of the range.

Example
[10/26/08 TO 10/26/08] specifies anything on the 26th of October, 2008.

Free Text Type

This is basically identical to the standard usage of the quick search functionality in Confluence, it will match the criteria set by this type with any word contained within the specified field. This is not case sensitive

Example
title:confluence - Brings back all content with a title that contains the word "confluence".
contentBody:confluence - Brings back all content which contains the word "confluence" in its body.

Exact Text Type

These types does a very strict search, all results will be IDENTICAL to the string used for the search, it is case sensitive and does not accept partial matches.

Example
labelText:confluence_search - brings back all content with the "confluence_search" label
spaceKey:DOC - brings back all content which are part of the Space with the space key "DOC"

User Type

Searches on the username of the user, it is tokenised so you can search for parts of the name (for users with spaces in their username), note that this is not a case sensitive search.

You can also specify ranges to search though, please refer to Range Searching for more details.

Example
username:[aa TO az] - Gets all results which the username contains a token which starts with "aa" to "az"
lastModifiers:[aa TO az] - Gets all content where the last modifier's username contains a token which starts with "aa" to "az"
creatorName:[aa TO az] - Gets all content where the creator's username contains a token which starts with "aa" to "az"

Content Type

This is basically exactly like the "What" dropdown list in the Confluence search results screen, used to filter content by its type, the valid values are:

Value Type Filter
page Pages
blogpost New Items
comment Comments
attachment Attachments
userinfo profiles
mail Mail
spacedesc Space Descriptions
personalspacedesc Personal Space Descriptions

Example
type:comment - Filters all results to include comments ONLY

Sizes Type

This lets you filter on the size of attachments in Confluence, all numbers are measured in bytes and can be used in conjunction with the Range Searching functionality to grab all attachments which are between certain sizes.

Example
filesize:[0 TO 1000] - Gets all attachments that are between 0 and 1000 bytes

Boolean Type

Boolean types are the most straightforward, values can ONLY be true or false.

Example
hasPersonalSpace:true - Gets all users which has a personal space

Special Search Syntax

Range Searching

This is one of the more useful functionalities of the Confluence searcher, the ability to specify ranges for your search, these ranges can be anything, numbers, dates, even strings, the syntax is:

start TO end

Where start is the start of the range to search through and end is the end of the range to search through, please note that the TO in the middle of the 2 values MUST be capitalized, otherwise an error occurs.

There is one other thing required for ranged searches, and that is the type of the ranged search, this can be inclusive or exclusive, to specify an inclusive search, put your search query in square brackets ([]) and for exclusive, put your search query in curly brackets ({}).

Example
So lets say you want to find all content CREATED in 2008, the query to use would be:

created:[1/1/08 TO 12/31/08]

Labels

confluence confluence Delete
search search Delete
lucene lucene Delete
metadata metadata Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.