Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Section
titleWhere Clauses in Display Macros

The where clause of display macros allows to add a constraint on the documents to display in the result set.

Section
titleProperty Names

To use property names in Lucene searches, the property names must not contain blanks. So if the search is restricted to user stories with just one story point, use this:

Code Block
languagetext
StoryPoints = "1" 

Template authors may use the $[...] marker to translate the property name to its normalized form:

Code Block
languagetext
$[Story Points] = "1" 

This is especially useful if the labels are provided by localized resource bundles. In this case the template author has not to bother, if the name contains spaces or not.

Note Box
titleExact Match Queries recommended

We would recommend to run Exact Match Queries per default on property values.

The example above does not use it so that we do not explain two concepts here.



Section
titleReference Property Values

If the result set should contain only documents where one property matches the value of a property of the current document, use the ${...} placeholder to reference the property in the current document.

Code Block
languagetext
$[Story Points] = ${Magic Value}

For the example, the result set will only contain documents, that have the Story Point property set to a value matching that of the Magic Value property of the document the search is part of.

Transclusion
document@self
idsExact Match Queries recommended



Content Marker
idcurly-braces


Caution Box
titleCurly Braces

Curly braces may cause problems on some instances of Confluence when used in a string parameter field of a macro. This is especially true (and reproducible) if you use an opening and an immediate closing bracket like this: "{}".

This is a known issue (CONFSERVER-33399) and is also discussed in Do curly braces in string macro parameters break the macro?

To work around this problem you may escape the curly braces with a backslash as in

Code Block
languagetext
$[Story Points] = $\{Magic Value\}

You need to use this workaround if you cannot save the page (as described in the issue above). Otherwise it is just a failed rendering of the macro in the macro editor.

This issue is solved since version 5.0.




Section
titleExact Match Queries

If the result should be an exact match query, use the following pattern:

Code Block
languagetext
$<Story Points> = [Magic Value]

In case the value is not a constant, you may also use a reference to the property of the document:

Code Block
languagetext
$<Story Points> = [${Magic Value}]


Note Box

The syntax $<...> is read as: Please run the preprocessor of projectdoc over the value before it is passed to Lucene.



Section
titleEscaping Special Characters

Since version 1.9 it is possible to escape special characters with a backslash (\).

Code Block
languagetext
$<Name> = [My Name \(with brackets\)]

To escape the escape character also use the escape character.

Code Block
languagetext
$<Name> = [My Name \\ containing a slash]



Section
titleDeep Links in Where Clause

Since version 2.0 of the projectdoc Toolbox Deep Links are supported for property references (on the right side) as an experimental features.

Example Box
$<Story Points> = [${Master->Ref Story Points}]

Note that you cannot use deep links on the left side of the where clause without Materialization. Since version 4.5 this is supported by property control mat, by space property Materialize by Doctype, or by Doctype Descriptor. Materialization is also possible in prior versions of the projectdoc Toolbox with a little more verbose approach. Read Materialize Properties for more information on this.


Section
titleSubtree Queries

If you need to constrain the search result to documents with a given ancestor, you can take advantage of artificial properties like AncestorNames and AncestorIds.

Code Block
languagetext
$<AncestorNames> = [This Root Page]

Or you could constrain the search result by the current page.

Code Block
languagetext
$<AncestorIds> = [${Page ID}]


Tip Box

See Subtree Queries for examples.



Section
titleAncestor Queries

For some type of properties it is useful to query for a given value or its ancestors. E.g. if you want to have all documents relevant for the Quick Response Team (QRT), a role derived from Ops, you may want to collect all documents marked with either QRT or Ops.

Code Block
languagetext
$<Audience> = ^QRT^

This is not only a shortcut for not listening all parents. If you add the following to the role template, the document will show all documents relevant for the role:

Code Block
languagetext
$<Audience> = ^${Name}^

Note that in the above example Audience is a property of a document that refers to documents of type Role. The hierarchy is defines on role documents. It may be confusing for new uses if they assume that the hierarchy is defined on the document containing the the Audience property.

If you need to search the hierarchy down the tree, use "°" instead of "^". So "°" stands for downstream, "^" for upstream search.

Caution Box

Ancestor queries are based on the property information in the blueprint of a document type. Document authors cannot define hierarchies based on document instances. It is the job of template authors to do this.

If you encounter unexpected results, you may want to refresh your caches, especially the doctype cache. Please refer to Cache Refresh Actions for details.


Tip Box

See Ancestor Queries for examples.



Section
titleList Queries


Version Box
title2.0

List queries are supported since version 2.0.


Content Marker
idList Query Examples

List queries run an exact match on a property where one of the values in the list has to match.

Code Block
$<Name> ~ (One, Two, Three)

expands to

Code Block
$<Name>=[One] OR $<Name>=[Two] OR $<Name>=[Three]

This is especially useful when a value is provided as a property.

Code Block
$<Name> ~ (${Some Names})

Note that the List of values found in Some Names may have links or be a macro (such as the Name List Macro). Values with a comma are not allowed since the comma is the delimiter of the list elements.



...