search()

Usage

search(type, key, value, key, value, ...)
search(type, key, value)
search(type, map)
search(type)

Description
The search() method is very similar to find(), except that it is case-insensitive / inexact. It returns a collection of entities, which can be empty if none of the existing nodes or relationships matches the given search parameters.

search() accepts several different parameter combinations, whereas the first parameter is always the name of the type to retrieve from the database. The second parameter can either be a map (e.g. a result from nested function calls) or a list of (key, value) pairs. Calling search() with only a single parameter will return all the nodes of the given type (which might be dangerous if there are many of them in the database).

Examples
For this example, we assume that there are three users in the database: [admin, tester1, tester2].

${search('User')}
${search('User', 'name', 'test')}

results in

[7379af469cd645aebe1a3f8d52b105bd, a05c044697d648aefe3ae4589af305bd, 505d0d469cd645aebe1a3f8d52b105bd]
[a05c044697d648aefe3ae4589af305bd, 505d0d469cd645aebe1a3f8d52b105bd]
About this article
Last change 2018-05-04
Topics FrontendFunctionsStructr 2.0