Close
Alfresco Search Enterprise

Search query syntax

Alfresco Search Enterprise supported search query syntax.

Applications and Frameworks

Note: Alfresco Share web application is not supported

Search Features

Search for a single term

Single terms are tokenized before the search according to the appropriate data dictionary definition(s).

If you do not specify a field, it will search in the content and in the following properties: name, title and description. This is a shortcut for searching all properties of type content. Terms can not contain a whitespace.

banana
TEXT:banana

Both of these queries will find any nodes with the word “banana” in any property of type d:content, however the first one will also get results from properties cm:name, cm:title or cm:description.

If the appropriate data dictionary definition(s) for the field supports both FTS and un-tokenized search, then FTS search will be used. FTS will include synonyms if the analyzer generates them.

Search in fields

Search specific fields rather than the default. Terms, and phrases can all be preceded by a field. If not the default field TEXT is used.

field:term
field:"phrase"
field:'phrase'
=field:exact
~field:expand

Note: Exact Term searching, using the equals operator (=field:exact in the samples above) is only allowed if the default Alfresco Repository configuration has been changed to enable this feature.

Fields fall into three types, property fields, special fields, and fields for data types. Property fields evaluate the search term against a particular property, special fields are described in the following table, and data type fields evaluate the search term against all properties of the given type.

Type Description
Property Fully qualified property, for example {http://www.alfresco.org/model/content/1.0}name:apple.
Property Fully qualified property, for example @{http://www.alfresco.org/model/content/1.0}name:apple.
Property CMIS style property, for example cm_name:apple.
Property Prefix style property, for example cm:name:apple.
Property Prefix style property, for example @cm:name:apple.
Property ID, for example ID:'599a6862-070c-49a7-a744-b88da949c31e'.
Property TEXT, for example TEXT:apple.
Property OWNER, for example OWNER:'admin'.
Property READER, for example READER:'GROUP_EVERYONE'.
Property DENIED, for example DENIED:'GROUP_EVERYONE'.
Special TYPE, for example TYPE:"qname".
Special ASPECT, for example ASPECT:"qname".
Special TAG, for example TAG:"name of the tag".
Special ALL, for example ALL:'admin'.
Special EXISTS, for example EXISTS cm:name:'Sample-Document.docx'.
Special ISNODE, for example ISNODE cm:name:'Sample-Document.docx'.
Field for Data Type Fully qualified Data Type, for example {http://www.alfresco.org/model/dictionary/1.0}content:apple.
Field for Data Type Data Type style property, for example d:content:apple.

Search for a phrase

Phrases are enclosed in double quotes. Any embedded quotes can be escaped using ‘’. If no field is specified then the default TEXT field will be used, as with searches for a single term.

The whole phrase will be tokenized before the search according to the appropriate data dictionary definition(s).

"big yellow banana"

Search for wildcards

Wildcards are supported in terms, phrases, and exact phrases using * to match zero, one, or more characters and ? to match a single character.

The * wildcard character can appear on its own and implies Google-style. The “anywhere after” wildcard pattern can be combined with the = prefix for identifier based pattern matching. Search will return and highlight any word that begins with the root of the word truncated by the * wildcard character.

All of the following will find the term apple.

TEXT:app?e
TEXT:app*
TEXT:*pple
appl?
*ple
=*ple
"ap*le"
"***le"
"?????"

Note: Exact Term searching, using the equals operator (=*ple in the samples above), is only allowed if the default Alfresco Repository configuration has been changed in order to enable this feature.

When performing a search that includes a wildcard character, it is best to wrap your search term in double quotation marks. This ensures all metadata and content are searched.

Search for conjunctions

Single terms, and phrases can be combined using AND in upper, lower, or mixed case.

The AND operator is interpreted as “every term is required”.

big AND yellow

These queries search for nodes that contain all the terms big and yellow in any content or in properties cm:name, cm:title or cm:description.

Search for disjunctions

Single terms, and phrases can be combined using OR in upper, lower, or mixed case.

The OR operator is interpreted as “at least one is required, more than one or all can be returned”.

By default search fragments will be ORed together.

big yellow banana
big OR yellow OR banana
TEXT:big TEXT:yellow TEXT:banana
TEXT:big OR TEXT:yellow OR TEXT:banana

These queries search for nodes that contain at least one of the terms big, yellow, or banana in any content. The first two will also get results from properties cm:name, cm:title or cm:description.

Search for negation

You can narrow your search results by excluding words with the NOT syntax. Single terms, and phrases can be combined using “NOT” in upper, lower, or mixed case, or prefixed with “!” or “-”. These queries search for nodes that contain the terms yellow in any content.

yellow NOT banana
yellow !banana
yellow -banana
NOT yellow banana
-yellow banana
!yellow banana

Note: In the three initial samples above, since OR is the default operator for searching, the results are expected to include every node with “yellow” and every node without the “banana” term. If you want to get nodes with the “yellow” term and without the term “banana”, use the following expression: yellow AND NOT banana.

The NOT operator can only be used for string keywords and doesn’t work for numerals or dates.

Prefixing any search qualifier with a - excludes all results that are matched by that qualifier.

Search for optional, mandatory, and excluded elements of a query

Sometimes AND and OR are not enough. If you want to find documents that must contain the term “car”, score those with the term “red” higher, but do not match those just containing “red”.

Operator Description
”,” The field, phrase, group is optional; a match increases the score.
”+” The field, phrase, group is mandatory.
”-“, “!” The field, phrase, group must not match.

The following example finds documents that contain the term “car”, score those with the term “red” higher, but does not match those just containing “red”:

+car |red

Note: At least one element of a query must match, or not match, for there to be any results.

All AND and OR constructs can be expressed with these operators.

Escaping characters

Any character can be escaped using the backslash “\” in terms, IDs (field identifiers), and phrases. Java unicode escape sequences are supported. Whitespace can be escaped in terms and IDs.

For example:

cm:my\ content:my\ name

Search for ranges

Inclusive ranges can be specified in Google-style. There is an extended syntax for more complex ranges. Unbounded ranges can be defined using MIN and MAX for numeric and date types and “u0000” and “FFFF” for text (anything that is invalid).

Lucene Google Description Example
[#1 TO #2] #1..#2 The range #1 to #2 inclusive #1 <= x <= #2 0..5[0 TO 5]
<#1 TO #2]   The range #1 to #2 including #2 but not #1.#1 < x <= #2 <0 TO 5]
[#1 TO #2>   The range #1 to #2 including #1 but not #2.#1 <= x < #2 [0 TO 5>
<#1 TO #2>   The range #1 to #2 exclusive.#1 < x < #2 <0 TO 5>
TEXT:apple..banana
my:int:[0 TO 10]
my:float:2.5..3.5
my:float:0..MAX
mt:text:[l TO "uFFFF"]

When searching for a date range you can use a partial date. Elasticsearch replaces the missing date components with the values below:

  • Month of year: 01
  • Day of month: 01
  • Hour of day: 23
  • Minute of hours: 59
  • Second of minute: 59
  • Nano of second: 999_999_999

The last four items will be replaced with 0 when the date component is missing in the minimum date in a range expression, e.g. [1950 to 2021] will be executed as [1950-01-01T00:00:00 TO 2021-01-01T23:59:59].

In the REST API you can specify the timezone to be used in search for date ranges.

{
    "query": {
        "query": "cm:created:['2021-05-01T09:00:00' TO '2021-05-28T09:05:59']",
        "language": "afts"
    },
    "localization": {
        "timezone": "Asia/Yerevan"
    }
}

Search for an exact term

Note: Exact Term searching is only allowed if default Alfresco Repository configuration has been changed in order to enable this feature.

To search for an exact term you must prefix it with “=”. The supported syntax:

=term
=term1 =term2
="multi term phrase"
=field:term
=field:term1 =field:term2
=field:“multi term phrase”

If you don’t specify a field the search runs against name, description, title, and content. If the field specified is TOKENIZED=false, only the full field is matched. If the field you specified is TOKENIZED=TRUE or TOKENIZED=BOTH then the search is run on the cross locale tokenized version of the field.

Note: Exact Term Search is disabled by default, for more see Pre-indexing considerations.

Searches that involve stopwords

Stopwords are removed from the query.

For example:

stopword1 quick fox stopword2 brown

becomes

quick fox brown

This behavior is different from Search and Insight Engine and Search Services in that it keeps stopwords in the query to build positional queries, for example:

stopword1 quick fox stopword2 brown

becomes

stopword1_quick quick fox_stopword2 fox stopword2_brown brown

Requesting optional item information

We have taken what we’re calling a “performance first” approach with the API. This means that each endpoint, by default, only returns the item information that is efficient to retrieve.

If additional processing is required on the server side to obtain the item information, then it’s made available via the include query parameter.

The http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/-my-/children?include=properties,aspectNames request shows how you can also include the properties and aspects for each node in your home folder when listing its children.

As with the orderBy and where parameters, the include parameter is specific to the endpoint so you’ll need to consult the API Explorer to see what extra item information is available.

Edit this page

Suggest an edit on GitHub
This website uses cookies in order to offer you the most relevant information. Please accept cookies for optimal performance. This documentation is subject to the Alfresco documentation terms.