Server

Full-Text Queries

Updated: December 19, 2024

Nuxeo documents can be searched using full-text queries; the standard way to do so is to use the top-right "quick search" box in the Nuxeo Platform. Search queries are expressed in a Nuxeo-defined syntax, described below.

Nuxeo Full-Text Query Syntax

A full-text query is a sequence of space-separated words. In addition:

  • Words are implicitly AND-ed together.
  • A word can start with - to signify negation (the word must not be present).
  • A word can end with * to signify prefix search (the word must start with this prefix). Ending a word with % instead of * for prefix search is also supported for historical reasons
  • You can use OR between words (it has a lower precedence than the implicit AND).
  • You can enclose several words in double quotes " for a phrase search (the words must exactly follow each other).

Examples

Documents containing both hello and world and which do not contain smurf:

hello world -smurf

Documents containing hello and a word starting with worl:

hello worl*

Documents containing both hello and world, or documents containing smurf but not containing black:

hello world OR smurf -black

Documents containing hello followed by world and also containing smurf:

"hello world" smurf

Important Notes and Limitations

The following limitations apply:

  • A query term (sequence of AND-ed words without an OR) containing only negations will not match anything.
  • Depending on the back-end database and its configuration, different word stemming strategies may be used, which means that universes and universal (for instance) may or may not be considered the same word. Check your database configuration for more on this, and the "analyzer" parameter used in the Nuxeo configuration for your database.
  • Phrase search using a PostgreSQL back-end database is supported and cannot use word stemming (i.e. a query of "hello worlds" will not match a document containing just hello world without a final s). This is due to way this feature is implemented, which is detailed at NXP-6720.
  • MongoDB does not support prefix matching, so a query for hel* will not match hello.

Using Full-Text Queries in NXQL

In NXQL the full-text query is part of a WHERE clause that can contain other matches on metadata. Inside the WHERE clause, a full-text query for "something" (as described in the previous section) can be expressed in several ways:

  • ecm:fulltext = 'something'
  • ecm:fulltext_someindex = 'something' if an index called "someindex" is configured in the Repository configuration
  • ecm:fulltext.somefield = 'something' to search a field called "somefield", using full-text if the VCS configuration contains a single index for it, or if not using fallback to a standard SQL ILIKE query: somefield ILIKE '%something%' (ILIKE is a case-independent LIKE). Note that this will have a serious performance impact if no full-text is used, and is provided only to help migrations from earlier versions.
  • ecm:fulltext LIKE 'something' is deprecated but identical to ecm:fulltext = 'something'.

Elasticsearch Extension

With an Elasticsearch page provider, the full-text syntax used is the Elasticsearch simple query string syntax. It is recommended to use the prefix es: when making such use of the syntax, as in the future it might be mandatory. Further more, any full-text request made with an es: prefix will be doing an "OR" between each word (vs AND otherwise). You can refer to the Elasticsearch documentation page for more details on the syntax that can be used.