Here are some more examples on using queries in various use cases. Section |
---|
| To select all resource documents that are read by a specific user ("jd " in this example) in a given year (specified by the document property Readjd in the format yyyy-MM-dd ), use the prefix query: Code Block |
---|
| ReadBy = "jd" AND Readjd = 2014* |
Section |
---|
title | Querying List Values |
---|
| The Tags Property is one that is supported by all document types. It specifies a comma-separated list of values. To select on those documents by tag values, use this: Code Block |
---|
| Tags = (("test-me" AND "continous-delivery") OR "My-Tag") |
Section |
---|
title | Search all Topic Types that are no Fragments |
---|
| A fragment is a basic document a couple of topic types (table, example, ...) derive from. To select only documents of a type that is not a fragment or one of its subtypes, use the following: Code Block |
---|
| +TypeAncestors:[* TO *] AND -TypeAncestors:Fragment |
Note that in this case all documents have to have their topic type specific. If those that have not should also be part of the result set, use: Code Block |
---|
| +Doctype:topic AND -TypeAncestors:Fragment |
Section |
---|
| Since version 1.10 the projectdoc Toolbox provides normalized date value to be used with Lucene searches. If the property value is specified with the Confluence Date Autocompletion (opened with the shortcut '// '), and for the creation and last modification date, a normalized date is provided as an artificial property. Image Removed The name of this artificial property is that of the original property plus the § -sign appended. Caution Box |
---|
Some versions of Confluence do no longer support "NOW" as part of the query string. We are working on a solution for this issue. See Jira |
---|
server | smartics JIRA |
---|
serverId | 79ad43bc-d289-364e-bfc7-46c09847bebd |
---|
key | PDAC-1059 |
---|
| . |
Here is an example where the creation date is check against a custom property named Last Update . Code Block |
---|
| $[Creation Date§]: [${Last Update§} TO NOW] |
There is also an artificial property value containing the date as a timestamp in milliseconds, prefixed with zeros up to 19 digits (%019d ). The name of the artificial property is constructed from the original name plus the suffix Timestamp (separated by a blank). Note that the creation timestamp is called Creation Timestamp (not Creation Date Timestamp ). Note Box |
---|
Appending the $-sign instead of the §-sign will render the text representation of the date. |
Section |
---|
| Confluence provides a couple of search fields to help finding the desired documents. Code Block |
---|
| created:[20150311 TO 20150317]
created:[20150311 TO NOW] |
Caution Box |
---|
Some versions of Confluence do no longer support "NOW" as part of the query string. We are working on a solution for this issue. See Jira |
---|
server | smartics JIRA |
---|
serverId | 79ad43bc-d289-364e-bfc7-46c09847bebd |
---|
key | PDAC-1059 |
---|
| . |
Caution Box |
---|
Currently (Confluence version 5.7) the more sophisticated searches are only possible via CQL, but not via the Confluence wiki interface (aka search field). Code Block |
---|
| created:[NOW-7DAY TO NOW]
created:[StartOfWeek TO NOW] | See Relative Date Queries with Confluence on Atlassian Answers |
|
Section |
---|
| You can select property values that are checkbox and use checkboxes in your where clauses. The checked checkbox has a text value of complete , an unchecked checkbox has a value of incomplete . See Tasks as Property Values for an example. |
Section |
---|
| In general Not in a query is only allowed when it follows an positive expression. To specify a document property not to have a certain value, use a range query like this: Code Block |
---|
| +ID:[* TO *] AND -ID:6555694 |
Section |
---|
title | Searching for an empty attribute using Not |
---|
| Searching all Documents having an attribute that is not set e.g. not having a parent. This is especially useful, if you want to list all root documents of a given document type (see Parent Property of projectdoc Documents for an example using the Parent Property). Code Block |
---|
*:* -Parent:[* TO *]
|
or Code Block |
---|
*:* NOT Parent:[* TO *]
|
The *:* is only needed if you have no positive criteria. A Lucene query must not start with "NOT". Tip Box |
---|
If you need to have all documents in the result that that actually have a parent, then use Code Block |
---|
| Parent:[* TO *] |
|
Note that you can only select on properties, not on sections. Caution Box |
---|
If you want to make sure that a document with a specific ID is not part of the result set, use this: Code Block |
---|
| Tags = "logging" NOT ID = 3704077 |
This does not do the trick (the syntax is wrong): Code Block |
---|
| Tags = "logging" AND ID NOT 3704077 |
|
|
|
|