Prefix QueryTo 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* |
Querying List ValuesThe 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") |
Search all Topic Types that are no FragmentsA 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 |
Using DatesSince 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.
The name of this artificial property is that of the original property plus the § -sign appended. 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. |
Using Date RangesConfluence provides a couple of search fields to help finding the desired documents. Code Block |
---|
| created:[20150311 TO 20150317]
created:[20150311 TO NOW] |
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. |
Using NotIn 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 |
Searching for an empty attribute using NotSearching 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. 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 |
|
|