Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

Searching content

Add search to an app through the expservices search domain, since the REST API has no search route - expsearch::search with text, limit, offset and a JSON filter (class, section, subtree, date), searching below a node…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/mobile-app-developers/json-endpoints/searching-content.md

On this page

Searching content

This page is for app developers who add a search field to an app. The REST content API has no search route, so search goes through the remote services' expsearch domain. The services are declared in extension/expservices/classes/content/expsearchservices.php.

Contents

  1. The main call
  2. Filters
  3. Narrower searches
  4. Autocomplete
  5. The answer
  6. Limits and good practice

The main call

expsearch::search::<text>::<limit>::<offset>::<filter json>
curl -s -H "X-Exp-Token: $EXPSERVICES_TOKEN" \
     'https://example.com/ezjscore/call/expsearch::search::solar%20panels::20::0?ContentType=json'

Percent-encode the text: spaces, and above all :, which would otherwise split arguments. The service needs content/read, and every hit is checked with canRead() before it is returned, so the results follow the user's rights.

Filters

The fourth argument is a JSON object, percent-encoded:

KeyValueEffect
classa list of class identifiersonly these classes
sectiona section idonly this section
subtreea list of node idsonly below these nodes
dateday, week, month, 3months or yearonly content published in that period
attributea class attribute idonly matches in that field
expsearch::search::solar::20::0::{"class":["article"],"subtree":[<node id>]}

(Shown unencoded for reading; encode the JSON in the URL.)

Narrower searches

ServiceArguments
expsearch::inSubtreetext, node id, limit, offset
expsearch::byClasstext, classes (a list), limit, offset
expsearch::bySectiontext, section id, limit, offset
expsearch::byAttributetext, class attribute id, limit, offset

Use inSubtree to keep an app's search inside the part of the tree the app shows.

Autocomplete

expsearch::suggest::<prefix>::<limit>

Returns words of the search index that start with the prefix, most used first. Call it after a short pause in typing, not on every keystroke.

The answer

data is a list of nodes in the expservices node format (node_id, object_id, class, name, url_alias, published, modified and more, from expContentBase::exportNode()). meta has the paging keys (total, offset, limit, count, has_more) plus stop_words (words the engine ignored) and text (the searched text). To show a hit, open it by node_id with the REST API (Reading a node).

Limits and good practice

  • The text must not be empty and may be at most 250 characters; otherwise 400.
  • If search is disabled on the installation, the service answers 403 "Search is disabled".
  • The quality of results depends on the search engine the installation uses: the built-in engine or Solr through eZ Find (Search with eZ Find and Solr). Ask which one yours runs (expsearch::engine, for signed-in users).
  • New content is found once it is indexed; with a delayed indexing setup that can take until the next cron run.
  • Show stop_words to the user when a search finds nothing because the words were ignored.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x