Versions Compared

Key

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

...

DoctypehideName
Document Properties Marker
overridefalse
doctypetopic
override
false


Search TipsShort DescriptionTips on specifying search queries for Lucene. This also applies to projectdoc's query macros.
NameSearch Tips
Parent
Parent Property
property-nameName

Audience
Name List
doctyperole
render-no-hits-as-blanktrue
render-list-as-comma-separated-valuestrue
namesAuthor, Documentation Architect, Documentation Gardener, Template Author
propertyAudience

Level of Experience
Name List
doctypeexperience-level
render-no-hits-as-blanktrue
propertyLevel of Experience

Expected Duration
Tags

Tag List
namesSearch


Iteration

Iteration
valueproduction

hide
Type
Name List
doctypetopic-type
render-no-hits-as-blanktrue
namesReference
propertyType

Sort Keyhide


...

sectionprojectdoc-section
Section
show-titlefalse
titleDescription

The projectdoc Toolbox uses Lucene for searching documents. This document provides some tips on how to formulate queries and extensions to searches provided by projectdoc.

projectdoc-
titlePrerequisites
box-caution
title
Abstract
Section
titleSelect Clauses in Display Macros
Use Exact Match Queries

Searches with Lucene are by design lenient. In case your are looking for a term, Lucene is capable of applying grammar rules to not run exact match searches. While this is great for the typical full text search, in case you are matching with properties you may want to be strict. For these use cases the projectdoc Toolbox provides the Exact Match Query.

Exact Match Queries are the recommended way of specifying queries.

Select a property by specifying the name of the property.

Example Box
titleSelect the value of the Name property

Name



Section
titlePrerequisites


Section
titleAbstract


Section
titleSelect Clauses in Display Macros

Select a property by specifying the name of the property.

Example Box
titleSelect the value of the Name property

Name


Section
titleDeep Links in Select Clause

Since version 2.0 the projectdoc Toolbox also supports Deep Links as an experimental feature. If the property name references a property whose value is a link, a deep link (specified with "->") allows to traverse the document tree.

Example Box
titleDeep Links

Suppose a document provides a property named "Ref" that is a reference to another document.

To select the short description of the referenced document, use Ref->Short Description.

Deep Links may have deeper depth than 1.

Example Box
titleDeep Links with Depth > 1

Ref->Person->Address->Phone

Note that prior to version 2.5 of the projectdoc Toolbox only single valued properties can be used with deep links. So if you are using an older version, if more than one link is found in a property value, only the first will be traversed.

Macros supporting Deep Links:

Display Table
doctypemacro
render-modedefinition
selectName, Short Description
space-keysPDAC1
where$<Tags>=[Deep Link]


...

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 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.




Macros from the projectdoc Toolbox perform searches with Lucene. Searchs with Lucene are by design lenient. In case your are looking for a term, Lucene is capable of applying grammar rules to not run exact match searches. While this is great for the typical full text search, in case you are matching with properties you may want to be strict. For these use cases the projectdoc Toolbox provides the Exact Match Query.
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. 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.



...