Search
Searching content
Content can be searched for by invoking the /@search
endpoint on any context:
GET /@search HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImZ1bGxuYW1lIjoiQWRtaW4iLCJpYXQiOjE2NDkzMTI0NDl9.RS1Ny_r0v7vIylFfK6q0JVJrkiDuTOh9iG9IL8xbzAk
Or use the client directly:
import { Client } from '@robgietema/nick';
const cli = Client.initialize({ apiPath: 'http://localhost:8080' });
const login = await cli.login({ username: 'admin', password: 'admin' });
const { data } = await cli.search({
token: login.data.token,
});
This will return all content object:
HTTP/1.1 200 OK
Content-Type: application/json
{
"@id": "http://localhost:8080/@search",
"items": [
{
"@id": "http://localhost:8080/events",
"@type": "Folder",
"title": "Events",
"UID": "1a2123ba-14e8-4910-8e6b-c04a40d72a41",
"path": "/events",
"Description": null,
"Title": "Events",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "events",
"Creator": "admin",
"id": "events",
"image_field": "",
"image_scales": {},
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:30:00.000Z",
"Date": "2022-04-02T20:30:00.000Z",
"expires": null,
"created": "2022-04-02T20:30:00.000Z",
"effective": "2022-04-02T20:30:00.000Z",
"getObjSize": 192,
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:30:00.000Z",
"EffectiveDate": "2022-04-02T20:30:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:30:00.000Z"
},
{
"@id": "http://localhost:8080/news",
"@type": "Folder",
"title": "News",
"UID": "32215c67-86de-462a-8cc0-eabcd2b39c26",
"path": "/news",
"Description": "News Items",
"Title": "News",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "news",
"Creator": "admin",
"id": "news",
"image_field": "",
"image_scales": {},
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:22:00.000Z",
"Date": "2022-04-02T20:22:00.000Z",
"expires": null,
"created": "2022-04-02T20:22:00.000Z",
"effective": "2022-04-02T20:22:00.000Z",
"getObjSize": 217,
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:22:00.000Z",
"EffectiveDate": "2022-04-02T20:22:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:22:00.000Z"
},
{
"@id": "http://localhost:8080/events/event-1",
"@type": "Page",
"title": "Event 1",
"UID": "405ca717-0c68-43a0-88ac-629a82658675",
"path": "/events/event-1",
"Description": null,
"Title": "Event 1",
"Subject": ["event"],
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Page",
"getId": "event-1",
"Creator": "admin",
"id": "event-1",
"image_field": "",
"image_scales": {},
"portal_type": "Page",
"review_state": "published",
"modified": "2022-04-02T20:10:00.000Z",
"Date": "2022-04-02T20:10:00.000Z",
"expires": null,
"created": "2022-04-02T20:10:00.000Z",
"effective": "2022-04-02T20:10:00.000Z",
"getObjSize": 421,
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:10:00.000Z",
"EffectiveDate": "2022-04-02T20:10:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:10:00.000Z"
},
{
"@id": "http://localhost:8080/users",
"@type": "Folder",
"title": "Users",
"UID": "80994493-74ca-4b94-9a7c-145a33a6dd80",
"path": "/users",
"Description": null,
"Title": "Users",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "users",
"Creator": "admin",
"id": "users",
"image_field": "",
"image_scales": {},
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:24:00.000Z",
"Date": "2022-04-02T20:24:00.000Z",
"expires": null,
"created": "2022-04-02T20:24:00.000Z",
"effective": "2022-04-02T20:24:00.000Z",
"getObjSize": 191,
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:24:00.000Z",
"EffectiveDate": "2022-04-02T20:24:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:24:00.000Z"
},
{
"@id": "http://localhost:8080/",
"@type": "Site",
"title": "Welcome to Nick!",
"UID": "92a80817-f5b7-400d-8f58-b08126f0f09b",
"path": "/",
"Description": "Congratulations! You have successfully installed Nick.",
"Title": "Welcome to Nick!",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": null,
"Type": "Site",
"getId": "root",
"Creator": "admin",
"id": "root",
"image_field": "",
"image_scales": {},
"portal_type": "Site",
"review_state": "published",
"modified": "2022-04-02T20:00:00.000Z",
"Date": "2022-04-02T20:00:00.000Z",
"expires": null,
"created": "2022-04-02T20:00:00.000Z",
"effective": "2022-04-02T20:00:00.000Z",
"getObjSize": 1806,
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:00:00.000Z",
"EffectiveDate": "2022-04-02T20:00:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:00:00.000Z"
}
],
"items_total": 5
}
Searching text
When you specify the SearchableText
parameter you can search for specific content:
GET /@search?SearchableText=news* HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImZ1bGxuYW1lIjoiQWRtaW4iLCJpYXQiOjE2NDkzMTI0NDl9.RS1Ny_r0v7vIylFfK6q0JVJrkiDuTOh9iG9IL8xbzAk
Or use the client directly:
import { Client } from '@robgietema/nick';
const cli = Client.initialize({ apiPath: 'http://localhost:8080' });
const login = await cli.login({ username: 'admin', password: 'admin' });
const { data } = await cli.search({
token: login.data.token,
query: {
SearchableText: 'news*',
},
});
This will return all content object:
HTTP/1.1 200 OK
Content-Type: application/json
{
"@id": "http://localhost:8080/@search",
"items": [
{
"@id": "http://localhost:8080/news",
"@type": "Folder",
"title": "News",
"UID": "32215c67-86de-462a-8cc0-eabcd2b39c26",
"path": "/news",
"Description": "News Items",
"Title": "News",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "news",
"Creator": "admin",
"id": "news",
"image_field": "",
"image_scales": {},
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:22:00.000Z",
"Date": "2022-04-02T20:22:00.000Z",
"expires": null,
"created": "2022-04-02T20:22:00.000Z",
"effective": "2022-04-02T20:22:00.000Z",
"getObjSize": 217,
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:22:00.000Z",
"EffectiveDate": "2022-04-02T20:22:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:22:00.000Z"
}
],
"items_total": 1
}
Sorting on title
You can also sort the search results on title:
GET /@search?sort_on=sortable_title HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImZ1bGxuYW1lIjoiQWRtaW4iLCJpYXQiOjE2NDkzMTI0NDl9.RS1Ny_r0v7vIylFfK6q0JVJrkiDuTOh9iG9IL8xbzAk
Or use the client directly:
import { Client } from '@robgietema/nick';
const cli = Client.initialize({ apiPath: 'http://localhost:8080' });
const login = await cli.login({ username: 'admin', password: 'admin' });
const { data } = await cli.search({
token: login.data.token,
query: {
sort_on: 'sortable_title',
},
});
This will return all content object:
HTTP/1.1 200 OK
Content-Type: application/json
{
"@id": "http://localhost:8080/@search",
"items": [
{
"@id": "http://localhost:8080/events/event-1",
"@type": "Page",
"title": "Event 1",
"UID": "405ca717-0c68-43a0-88ac-629a82658675",
"path": "/events/event-1",
"Description": null,
"Title": "Event 1",
"Subject": ["event"],
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Page",
"getId": "event-1",
"Creator": "admin",
"id": "event-1",
"portal_type": "Page",
"review_state": "published",
"modified": "2022-04-02T20:10:00.000Z",
"Date": "2022-04-02T20:10:00.000Z",
"expires": null,
"created": "2022-04-02T20:10:00.000Z",
"effective": "2022-04-02T20:10:00.000Z",
"getObjSize": 421,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:10:00.000Z",
"EffectiveDate": "2022-04-02T20:10:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:10:00.000Z"
},
{
"@id": "http://localhost:8080/events",
"@type": "Folder",
"title": "Events",
"UID": "1a2123ba-14e8-4910-8e6b-c04a40d72a41",
"path": "/events",
"Description": null,
"Title": "Events",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "events",
"Creator": "admin",
"id": "events",
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:30:00.000Z",
"Date": "2022-04-02T20:30:00.000Z",
"expires": null,
"created": "2022-04-02T20:30:00.000Z",
"effective": "2022-04-02T20:30:00.000Z",
"getObjSize": 192,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:30:00.000Z",
"EffectiveDate": "2022-04-02T20:30:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:30:00.000Z"
},
{
"@id": "http://localhost:8080/news",
"@type": "Folder",
"title": "News",
"UID": "32215c67-86de-462a-8cc0-eabcd2b39c26",
"path": "/news",
"Description": "News Items",
"Title": "News",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "news",
"Creator": "admin",
"id": "news",
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:22:00.000Z",
"Date": "2022-04-02T20:22:00.000Z",
"expires": null,
"created": "2022-04-02T20:22:00.000Z",
"effective": "2022-04-02T20:22:00.000Z",
"getObjSize": 217,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:22:00.000Z",
"EffectiveDate": "2022-04-02T20:22:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:22:00.000Z"
},
{
"@id": "http://localhost:8080/users",
"@type": "Folder",
"title": "Users",
"UID": "80994493-74ca-4b94-9a7c-145a33a6dd80",
"path": "/users",
"Description": null,
"Title": "Users",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "users",
"Creator": "admin",
"id": "users",
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:24:00.000Z",
"Date": "2022-04-02T20:24:00.000Z",
"expires": null,
"created": "2022-04-02T20:24:00.000Z",
"effective": "2022-04-02T20:24:00.000Z",
"getObjSize": 191,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:24:00.000Z",
"EffectiveDate": "2022-04-02T20:24:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:24:00.000Z"
},
{
"@id": "http://localhost:8080/",
"@type": "Site",
"title": "Welcome to Nick!",
"UID": "92a80817-f5b7-400d-8f58-b08126f0f09b",
"path": "/",
"Description": "Congratulations! You have successfully installed Nick.",
"Title": "Welcome to Nick!",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": null,
"Type": "Site",
"getId": "root",
"Creator": "admin",
"id": "root",
"portal_type": "Site",
"review_state": "published",
"modified": "2022-04-02T20:00:00.000Z",
"Date": "2022-04-02T20:00:00.000Z",
"expires": null,
"created": "2022-04-02T20:00:00.000Z",
"effective": "2022-04-02T20:00:00.000Z",
"getObjSize": 1806,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:00:00.000Z",
"EffectiveDate": "2022-04-02T20:00:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:00:00.000Z"
}
],
"items_total": 5
}
Sorting on date
You can also sort the search results on date:
GET /@search?sort_on=effective HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImZ1bGxuYW1lIjoiQWRtaW4iLCJpYXQiOjE2NDkzMTI0NDl9.RS1Ny_r0v7vIylFfK6q0JVJrkiDuTOh9iG9IL8xbzAk
Or use the client directly:
import { Client } from '@robgietema/nick';
const cli = Client.initialize({ apiPath: 'http://localhost:8080' });
const login = await cli.login({ username: 'admin', password: 'admin' });
const { data } = await cli.search({
token: login.data.token,
query: {
sort_on: 'effective',
},
});
This will return all content object:
HTTP/1.1 200 OK
Content-Type: application/json
{
"@id": "http://localhost:8080/@search",
"items": [
{
"@id": "http://localhost:8080/",
"@type": "Site",
"title": "Welcome to Nick!",
"UID": "92a80817-f5b7-400d-8f58-b08126f0f09b",
"path": "/",
"Description": "Congratulations! You have successfully installed Nick.",
"Title": "Welcome to Nick!",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": null,
"Type": "Site",
"getId": "root",
"Creator": "admin",
"id": "root",
"portal_type": "Site",
"review_state": "published",
"modified": "2022-04-02T20:00:00.000Z",
"Date": "2022-04-02T20:00:00.000Z",
"expires": null,
"created": "2022-04-02T20:00:00.000Z",
"effective": "2022-04-02T20:00:00.000Z",
"getObjSize": 1806,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:00:00.000Z",
"EffectiveDate": "2022-04-02T20:00:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:00:00.000Z"
},
{
"@id": "http://localhost:8080/events/event-1",
"@type": "Page",
"title": "Event 1",
"UID": "405ca717-0c68-43a0-88ac-629a82658675",
"path": "/events/event-1",
"Description": null,
"Title": "Event 1",
"Subject": ["event"],
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Page",
"getId": "event-1",
"Creator": "admin",
"id": "event-1",
"portal_type": "Page",
"review_state": "published",
"modified": "2022-04-02T20:10:00.000Z",
"Date": "2022-04-02T20:10:00.000Z",
"expires": null,
"created": "2022-04-02T20:10:00.000Z",
"effective": "2022-04-02T20:10:00.000Z",
"getObjSize": 421,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:10:00.000Z",
"EffectiveDate": "2022-04-02T20:10:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:10:00.000Z"
},
{
"@id": "http://localhost:8080/news",
"@type": "Folder",
"title": "News",
"UID": "32215c67-86de-462a-8cc0-eabcd2b39c26",
"path": "/news",
"Description": "News Items",
"Title": "News",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "news",
"Creator": "admin",
"id": "news",
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:22:00.000Z",
"Date": "2022-04-02T20:22:00.000Z",
"expires": null,
"created": "2022-04-02T20:22:00.000Z",
"effective": "2022-04-02T20:22:00.000Z",
"getObjSize": 217,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:22:00.000Z",
"EffectiveDate": "2022-04-02T20:22:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:22:00.000Z"
},
{
"@id": "http://localhost:8080/users",
"@type": "Folder",
"title": "Users",
"UID": "80994493-74ca-4b94-9a7c-145a33a6dd80",
"path": "/users",
"Description": null,
"Title": "Users",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "users",
"Creator": "admin",
"id": "users",
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:24:00.000Z",
"Date": "2022-04-02T20:24:00.000Z",
"expires": null,
"created": "2022-04-02T20:24:00.000Z",
"effective": "2022-04-02T20:24:00.000Z",
"getObjSize": 191,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:24:00.000Z",
"EffectiveDate": "2022-04-02T20:24:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:24:00.000Z"
},
{
"@id": "http://localhost:8080/events",
"@type": "Folder",
"title": "Events",
"UID": "1a2123ba-14e8-4910-8e6b-c04a40d72a41",
"path": "/events",
"Description": null,
"Title": "Events",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "events",
"Creator": "admin",
"id": "events",
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:30:00.000Z",
"Date": "2022-04-02T20:30:00.000Z",
"expires": null,
"created": "2022-04-02T20:30:00.000Z",
"effective": "2022-04-02T20:30:00.000Z",
"getObjSize": 192,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:30:00.000Z",
"EffectiveDate": "2022-04-02T20:30:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:30:00.000Z"
}
],
"items_total": 5
}
Sorting on unknown
When you sort on an unknown column it will be ignored:
GET /@search?sort_on=unknown HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImZ1bGxuYW1lIjoiQWRtaW4iLCJpYXQiOjE2NDkzMTI0NDl9.RS1Ny_r0v7vIylFfK6q0JVJrkiDuTOh9iG9IL8xbzAk
Or use the client directly:
import { Client } from '@robgietema/nick';
const cli = Client.initialize({ apiPath: 'http://localhost:8080' });
const login = await cli.login({ username: 'admin', password: 'admin' });
const { data } = await cli.search({
token: login.data.token,
query: {
sort_on: 'unknown',
},
});
This will return all content object:
HTTP/1.1 200 OK
Content-Type: application/json
{
"@id": "http://localhost:8080/@search",
"items": [
{
"@id": "http://localhost:8080/events",
"@type": "Folder",
"title": "Events",
"UID": "1a2123ba-14e8-4910-8e6b-c04a40d72a41",
"path": "/events",
"Description": null,
"Title": "Events",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "events",
"Creator": "admin",
"id": "events",
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:30:00.000Z",
"Date": "2022-04-02T20:30:00.000Z",
"expires": null,
"created": "2022-04-02T20:30:00.000Z",
"effective": "2022-04-02T20:30:00.000Z",
"getObjSize": 192,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:30:00.000Z",
"EffectiveDate": "2022-04-02T20:30:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:30:00.000Z"
},
{
"@id": "http://localhost:8080/news",
"@type": "Folder",
"title": "News",
"UID": "32215c67-86de-462a-8cc0-eabcd2b39c26",
"path": "/news",
"Description": "News Items",
"Title": "News",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "news",
"Creator": "admin",
"id": "news",
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:22:00.000Z",
"Date": "2022-04-02T20:22:00.000Z",
"expires": null,
"created": "2022-04-02T20:22:00.000Z",
"effective": "2022-04-02T20:22:00.000Z",
"getObjSize": 217,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:22:00.000Z",
"EffectiveDate": "2022-04-02T20:22:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:22:00.000Z"
},
{
"@id": "http://localhost:8080/events/event-1",
"@type": "Page",
"title": "Event 1",
"UID": "405ca717-0c68-43a0-88ac-629a82658675",
"path": "/events/event-1",
"Description": null,
"Title": "Event 1",
"Subject": ["event"],
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Page",
"getId": "event-1",
"Creator": "admin",
"id": "event-1",
"portal_type": "Page",
"review_state": "published",
"modified": "2022-04-02T20:10:00.000Z",
"Date": "2022-04-02T20:10:00.000Z",
"expires": null,
"created": "2022-04-02T20:10:00.000Z",
"effective": "2022-04-02T20:10:00.000Z",
"getObjSize": 421,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:10:00.000Z",
"EffectiveDate": "2022-04-02T20:10:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:10:00.000Z"
},
{
"@id": "http://localhost:8080/users",
"@type": "Folder",
"title": "Users",
"UID": "80994493-74ca-4b94-9a7c-145a33a6dd80",
"path": "/users",
"Description": null,
"Title": "Users",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "users",
"Creator": "admin",
"id": "users",
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:24:00.000Z",
"Date": "2022-04-02T20:24:00.000Z",
"expires": null,
"created": "2022-04-02T20:24:00.000Z",
"effective": "2022-04-02T20:24:00.000Z",
"getObjSize": 191,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:24:00.000Z",
"EffectiveDate": "2022-04-02T20:24:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:24:00.000Z"
},
{
"@id": "http://localhost:8080/",
"@type": "Site",
"title": "Welcome to Nick!",
"UID": "92a80817-f5b7-400d-8f58-b08126f0f09b",
"path": "/",
"Description": "Congratulations! You have successfully installed Nick.",
"Title": "Welcome to Nick!",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": null,
"Type": "Site",
"getId": "root",
"Creator": "admin",
"id": "root",
"portal_type": "Site",
"review_state": "published",
"modified": "2022-04-02T20:00:00.000Z",
"Date": "2022-04-02T20:00:00.000Z",
"expires": null,
"created": "2022-04-02T20:00:00.000Z",
"effective": "2022-04-02T20:00:00.000Z",
"getObjSize": 1806,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:00:00.000Z",
"EffectiveDate": "2022-04-02T20:00:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:00:00.000Z"
}
],
"items_total": 5
}
Sorting reverse
You can also sort the search results reverse:
GET /@search?sort_on=sortable_title&sort_order=descending HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImZ1bGxuYW1lIjoiQWRtaW4iLCJpYXQiOjE2NDkzMTI0NDl9.RS1Ny_r0v7vIylFfK6q0JVJrkiDuTOh9iG9IL8xbzAk
Or use the client directly:
import { Client } from '@robgietema/nick';
const cli = Client.initialize({ apiPath: 'http://localhost:8080' });
const login = await cli.login({ username: 'admin', password: 'admin' });
const { data } = await cli.search({
token: login.data.token,
query: {
sort_on: 'sortable_title',
sort_order: 'descending',
},
});
This will return all content object:
HTTP/1.1 200 OK
Content-Type: application/json
{
"@id": "http://localhost:8080/@search",
"items": [
{
"@id": "http://localhost:8080/",
"@type": "Site",
"title": "Welcome to Nick!",
"UID": "92a80817-f5b7-400d-8f58-b08126f0f09b",
"path": "/",
"Description": "Congratulations! You have successfully installed Nick.",
"Title": "Welcome to Nick!",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": null,
"Type": "Site",
"getId": "root",
"Creator": "admin",
"id": "root",
"portal_type": "Site",
"review_state": "published",
"modified": "2022-04-02T20:00:00.000Z",
"Date": "2022-04-02T20:00:00.000Z",
"expires": null,
"created": "2022-04-02T20:00:00.000Z",
"effective": "2022-04-02T20:00:00.000Z",
"getObjSize": 1806,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:00:00.000Z",
"EffectiveDate": "2022-04-02T20:00:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:00:00.000Z"
},
{
"@id": "http://localhost:8080/users",
"@type": "Folder",
"title": "Users",
"UID": "80994493-74ca-4b94-9a7c-145a33a6dd80",
"path": "/users",
"Description": null,
"Title": "Users",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "users",
"Creator": "admin",
"id": "users",
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:24:00.000Z",
"Date": "2022-04-02T20:24:00.000Z",
"expires": null,
"created": "2022-04-02T20:24:00.000Z",
"effective": "2022-04-02T20:24:00.000Z",
"getObjSize": 191,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:24:00.000Z",
"EffectiveDate": "2022-04-02T20:24:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:24:00.000Z"
},
{
"@id": "http://localhost:8080/news",
"@type": "Folder",
"title": "News",
"UID": "32215c67-86de-462a-8cc0-eabcd2b39c26",
"path": "/news",
"Description": "News Items",
"Title": "News",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "news",
"Creator": "admin",
"id": "news",
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:22:00.000Z",
"Date": "2022-04-02T20:22:00.000Z",
"expires": null,
"created": "2022-04-02T20:22:00.000Z",
"effective": "2022-04-02T20:22:00.000Z",
"getObjSize": 217,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:22:00.000Z",
"EffectiveDate": "2022-04-02T20:22:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:22:00.000Z"
},
{
"@id": "http://localhost:8080/events",
"@type": "Folder",
"title": "Events",
"UID": "1a2123ba-14e8-4910-8e6b-c04a40d72a41",
"path": "/events",
"Description": null,
"Title": "Events",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "events",
"Creator": "admin",
"id": "events",
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:30:00.000Z",
"Date": "2022-04-02T20:30:00.000Z",
"expires": null,
"created": "2022-04-02T20:30:00.000Z",
"effective": "2022-04-02T20:30:00.000Z",
"getObjSize": 192,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:30:00.000Z",
"EffectiveDate": "2022-04-02T20:30:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:30:00.000Z"
},
{
"@id": "http://localhost:8080/events/event-1",
"@type": "Page",
"title": "Event 1",
"UID": "405ca717-0c68-43a0-88ac-629a82658675",
"path": "/events/event-1",
"Description": null,
"Title": "Event 1",
"Subject": ["event"],
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Page",
"getId": "event-1",
"Creator": "admin",
"id": "event-1",
"portal_type": "Page",
"review_state": "published",
"modified": "2022-04-02T20:10:00.000Z",
"Date": "2022-04-02T20:10:00.000Z",
"expires": null,
"created": "2022-04-02T20:10:00.000Z",
"effective": "2022-04-02T20:10:00.000Z",
"getObjSize": 421,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:10:00.000Z",
"EffectiveDate": "2022-04-02T20:10:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:10:00.000Z"
}
],
"items_total": 5
}
Sorting depth
You can specify the depth used to search:
GET /@search?path.depth=1 HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImZ1bGxuYW1lIjoiQWRtaW4iLCJpYXQiOjE2NDkzMTI0NDl9.RS1Ny_r0v7vIylFfK6q0JVJrkiDuTOh9iG9IL8xbzAk
Or use the client directly:
import { Client } from '@robgietema/nick';
const cli = Client.initialize({ apiPath: 'http://localhost:8080' });
const login = await cli.login({ username: 'admin', password: 'admin' });
const { data } = await cli.search({
token: login.data.token,
query: {
'path.depth': 1,
},
});
This will return all content object:
HTTP/1.1 200 OK
Content-Type: application/json
{
"@id": "http://localhost:8080/@search",
"items": [
{
"@id": "http://localhost:8080/events",
"@type": "Folder",
"title": "Events",
"UID": "1a2123ba-14e8-4910-8e6b-c04a40d72a41",
"path": "/events",
"Description": null,
"Title": "Events",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "events",
"Creator": "admin",
"id": "events",
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:30:00.000Z",
"Date": "2022-04-02T20:30:00.000Z",
"expires": null,
"created": "2022-04-02T20:30:00.000Z",
"effective": "2022-04-02T20:30:00.000Z",
"getObjSize": 192,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:30:00.000Z",
"EffectiveDate": "2022-04-02T20:30:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:30:00.000Z"
},
{
"@id": "http://localhost:8080/news",
"@type": "Folder",
"title": "News",
"UID": "32215c67-86de-462a-8cc0-eabcd2b39c26",
"path": "/news",
"Description": "News Items",
"Title": "News",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "news",
"Creator": "admin",
"id": "news",
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:22:00.000Z",
"Date": "2022-04-02T20:22:00.000Z",
"expires": null,
"created": "2022-04-02T20:22:00.000Z",
"effective": "2022-04-02T20:22:00.000Z",
"getObjSize": 217,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:22:00.000Z",
"EffectiveDate": "2022-04-02T20:22:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:22:00.000Z"
},
{
"@id": "http://localhost:8080/users",
"@type": "Folder",
"title": "Users",
"UID": "80994493-74ca-4b94-9a7c-145a33a6dd80",
"path": "/users",
"Description": null,
"Title": "Users",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "users",
"Creator": "admin",
"id": "users",
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:24:00.000Z",
"Date": "2022-04-02T20:24:00.000Z",
"expires": null,
"created": "2022-04-02T20:24:00.000Z",
"effective": "2022-04-02T20:24:00.000Z",
"getObjSize": 191,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:24:00.000Z",
"EffectiveDate": "2022-04-02T20:24:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:24:00.000Z"
}
],
"items_total": 3
}
Sorting using batching
You can specify the batch size when searching:
GET /@search?b_size=2 HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImZ1bGxuYW1lIjoiQWRtaW4iLCJpYXQiOjE2NDkzMTI0NDl9.RS1Ny_r0v7vIylFfK6q0JVJrkiDuTOh9iG9IL8xbzAk
Or use the client directly:
import { Client } from '@robgietema/nick';
const cli = Client.initialize({ apiPath: 'http://localhost:8080' });
const login = await cli.login({ username: 'admin', password: 'admin' });
const { data } = await cli.search({
token: login.data.token,
query: {
b_size: 2,
},
});
This will return all content object:
HTTP/1.1 200 OK
Content-Type: application/json
{
"@id": "http://localhost:8080/@search",
"items": [
{
"@id": "http://localhost:8080/events",
"@type": "Folder",
"title": "Events",
"UID": "1a2123ba-14e8-4910-8e6b-c04a40d72a41",
"path": "/events",
"Description": null,
"Title": "Events",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "events",
"Creator": "admin",
"id": "events",
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:30:00.000Z",
"Date": "2022-04-02T20:30:00.000Z",
"expires": null,
"created": "2022-04-02T20:30:00.000Z",
"effective": "2022-04-02T20:30:00.000Z",
"getObjSize": 192,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:30:00.000Z",
"EffectiveDate": "2022-04-02T20:30:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:30:00.000Z"
},
{
"@id": "http://localhost:8080/news",
"@type": "Folder",
"title": "News",
"UID": "32215c67-86de-462a-8cc0-eabcd2b39c26",
"path": "/news",
"Description": "News Items",
"Title": "News",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "news",
"Creator": "admin",
"id": "news",
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:22:00.000Z",
"Date": "2022-04-02T20:22:00.000Z",
"expires": null,
"created": "2022-04-02T20:22:00.000Z",
"effective": "2022-04-02T20:22:00.000Z",
"getObjSize": 217,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:22:00.000Z",
"EffectiveDate": "2022-04-02T20:22:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:22:00.000Z"
}
],
"items_total": 2
}
Sorting using batch offset
You can specify the batch offset of the search:
GET /@search?b_size=3&b_start=2 HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImZ1bGxuYW1lIjoiQWRtaW4iLCJpYXQiOjE2NDkzMTI0NDl9.RS1Ny_r0v7vIylFfK6q0JVJrkiDuTOh9iG9IL8xbzAk
Or use the client directly:
import { Client } from '@robgietema/nick';
const cli = Client.initialize({ apiPath: 'http://localhost:8080' });
const login = await cli.login({ username: 'admin', password: 'admin' });
const { data } = await cli.search({
token: login.data.token,
query: {
b_size: 3,
b_start: 2,
},
});
This will return all content object:
HTTP/1.1 200 OK
Content-Type: application/json
{
"@id": "http://localhost:8080/@search",
"items": [
{
"@id": "http://localhost:8080/events/event-1",
"@type": "Page",
"title": "Event 1",
"UID": "405ca717-0c68-43a0-88ac-629a82658675",
"path": "/events/event-1",
"Description": null,
"Title": "Event 1",
"Subject": ["event"],
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Page",
"getId": "event-1",
"Creator": "admin",
"id": "event-1",
"portal_type": "Page",
"review_state": "published",
"modified": "2022-04-02T20:10:00.000Z",
"Date": "2022-04-02T20:10:00.000Z",
"expires": null,
"created": "2022-04-02T20:10:00.000Z",
"effective": "2022-04-02T20:10:00.000Z",
"getObjSize": 421,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:10:00.000Z",
"EffectiveDate": "2022-04-02T20:10:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:10:00.000Z"
},
{
"@id": "http://localhost:8080/users",
"@type": "Folder",
"title": "Users",
"UID": "80994493-74ca-4b94-9a7c-145a33a6dd80",
"path": "/users",
"Description": null,
"Title": "Users",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "users",
"Creator": "admin",
"id": "users",
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:24:00.000Z",
"Date": "2022-04-02T20:24:00.000Z",
"expires": null,
"created": "2022-04-02T20:24:00.000Z",
"effective": "2022-04-02T20:24:00.000Z",
"getObjSize": 191,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:24:00.000Z",
"EffectiveDate": "2022-04-02T20:24:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:24:00.000Z"
},
{
"@id": "http://localhost:8080/",
"@type": "Site",
"title": "Welcome to Nick!",
"UID": "92a80817-f5b7-400d-8f58-b08126f0f09b",
"path": "/",
"Description": "Congratulations! You have successfully installed Nick.",
"Title": "Welcome to Nick!",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": null,
"Type": "Site",
"getId": "root",
"Creator": "admin",
"id": "root",
"portal_type": "Site",
"review_state": "published",
"modified": "2022-04-02T20:00:00.000Z",
"Date": "2022-04-02T20:00:00.000Z",
"expires": null,
"created": "2022-04-02T20:00:00.000Z",
"effective": "2022-04-02T20:00:00.000Z",
"getObjSize": 1806,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:00:00.000Z",
"EffectiveDate": "2022-04-02T20:00:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:00:00.000Z"
}
],
"items_total": 3
}
Sorting on unknown
It will ignore unknown parameters:
GET /@search?unknown HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImZ1bGxuYW1lIjoiQWRtaW4iLCJpYXQiOjE2NDkzMTI0NDl9.RS1Ny_r0v7vIylFfK6q0JVJrkiDuTOh9iG9IL8xbzAk
Or use the client directly:
import { Client } from '@robgietema/nick';
const cli = Client.initialize({ apiPath: 'http://localhost:8080' });
const login = await cli.login({ username: 'admin', password: 'admin' });
const { data } = await cli.search({
token: login.data.token,
query: {
unknown: 'unknown',
},
});
This will return all content object:
HTTP/1.1 200 OK
Content-Type: application/json
{
"@id": "http://localhost:8080/@search",
"items": [
{
"@id": "http://localhost:8080/events",
"@type": "Folder",
"title": "Events",
"UID": "1a2123ba-14e8-4910-8e6b-c04a40d72a41",
"path": "/events",
"Description": null,
"Title": "Events",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "events",
"Creator": "admin",
"id": "events",
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:30:00.000Z",
"Date": "2022-04-02T20:30:00.000Z",
"expires": null,
"created": "2022-04-02T20:30:00.000Z",
"effective": "2022-04-02T20:30:00.000Z",
"getObjSize": 192,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:30:00.000Z",
"EffectiveDate": "2022-04-02T20:30:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:30:00.000Z"
},
{
"@id": "http://localhost:8080/news",
"@type": "Folder",
"title": "News",
"UID": "32215c67-86de-462a-8cc0-eabcd2b39c26",
"path": "/news",
"Description": "News Items",
"Title": "News",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "news",
"Creator": "admin",
"id": "news",
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:22:00.000Z",
"Date": "2022-04-02T20:22:00.000Z",
"expires": null,
"created": "2022-04-02T20:22:00.000Z",
"effective": "2022-04-02T20:22:00.000Z",
"getObjSize": 217,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:22:00.000Z",
"EffectiveDate": "2022-04-02T20:22:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:22:00.000Z"
},
{
"@id": "http://localhost:8080/events/event-1",
"@type": "Page",
"title": "Event 1",
"UID": "405ca717-0c68-43a0-88ac-629a82658675",
"path": "/events/event-1",
"Description": null,
"Title": "Event 1",
"Subject": ["event"],
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Page",
"getId": "event-1",
"Creator": "admin",
"id": "event-1",
"portal_type": "Page",
"review_state": "published",
"modified": "2022-04-02T20:10:00.000Z",
"Date": "2022-04-02T20:10:00.000Z",
"expires": null,
"created": "2022-04-02T20:10:00.000Z",
"effective": "2022-04-02T20:10:00.000Z",
"getObjSize": 421,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:10:00.000Z",
"EffectiveDate": "2022-04-02T20:10:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:10:00.000Z"
},
{
"@id": "http://localhost:8080/users",
"@type": "Folder",
"title": "Users",
"UID": "80994493-74ca-4b94-9a7c-145a33a6dd80",
"path": "/users",
"Description": null,
"Title": "Users",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "users",
"Creator": "admin",
"id": "users",
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:24:00.000Z",
"Date": "2022-04-02T20:24:00.000Z",
"expires": null,
"created": "2022-04-02T20:24:00.000Z",
"effective": "2022-04-02T20:24:00.000Z",
"getObjSize": 191,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:24:00.000Z",
"EffectiveDate": "2022-04-02T20:24:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:24:00.000Z"
},
{
"@id": "http://localhost:8080/",
"@type": "Site",
"title": "Welcome to Nick!",
"UID": "92a80817-f5b7-400d-8f58-b08126f0f09b",
"path": "/",
"Description": "Congratulations! You have successfully installed Nick.",
"Title": "Welcome to Nick!",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": null,
"Type": "Site",
"getId": "root",
"Creator": "admin",
"id": "root",
"portal_type": "Site",
"review_state": "published",
"modified": "2022-04-02T20:00:00.000Z",
"Date": "2022-04-02T20:00:00.000Z",
"expires": null,
"created": "2022-04-02T20:00:00.000Z",
"effective": "2022-04-02T20:00:00.000Z",
"getObjSize": 1806,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:00:00.000Z",
"EffectiveDate": "2022-04-02T20:00:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:00:00.000Z"
}
],
"items_total": 5
}
Sorting querystring search
You can also search using a POST
call and specify a querystring:
POST /@querystring-search HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImZ1bGxuYW1lIjoiQWRtaW4iLCJpYXQiOjE2NDkzMTI0NDl9.RS1Ny_r0v7vIylFfK6q0JVJrkiDuTOh9iG9IL8xbzAk
{
"query": [
{
"i": "SearchableText",
"o": "string.contains",
"v": "Event"
}
]
}
Or use the client directly:
import { Client } from '@robgietema/nick';
const cli = Client.initialize({ apiPath: 'http://localhost:8080' });
const login = await cli.login({ username: 'admin', password: 'admin' });
const { data } = await cli.querystringSearch({
token: login.data.token,
});
This will return all content object:
HTTP/1.1 200 OK
Content-Type: application/json
{
"@id": "http://localhost:8080/@search",
"items": [
{
"@id": "http://localhost:8080/events",
"@type": "Folder",
"title": "Events",
"UID": "1a2123ba-14e8-4910-8e6b-c04a40d72a41",
"path": "/events",
"Description": null,
"Title": "Events",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "events",
"Creator": "admin",
"id": "events",
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:30:00.000Z",
"Date": "2022-04-02T20:30:00.000Z",
"expires": null,
"created": "2022-04-02T20:30:00.000Z",
"effective": "2022-04-02T20:30:00.000Z",
"getObjSize": 192,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:30:00.000Z",
"EffectiveDate": "2022-04-02T20:30:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:30:00.000Z"
},
{
"@id": "http://localhost:8080/events/event-1",
"@type": "Page",
"title": "Event 1",
"UID": "405ca717-0c68-43a0-88ac-629a82658675",
"path": "/events/event-1",
"Description": null,
"Title": "Event 1",
"Subject": ["event"],
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Page",
"getId": "event-1",
"Creator": "admin",
"id": "event-1",
"portal_type": "Page",
"review_state": "published",
"modified": "2022-04-02T20:10:00.000Z",
"Date": "2022-04-02T20:10:00.000Z",
"expires": null,
"created": "2022-04-02T20:10:00.000Z",
"effective": "2022-04-02T20:10:00.000Z",
"getObjSize": 421,
"image_field": "",
"image_scales": {},
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:10:00.000Z",
"EffectiveDate": "2022-04-02T20:10:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:10:00.000Z"
}
],
"items_total": 2
}
Searching using an embedding model
When AI is enabled in the config you can search based on embeddings
. When you provide a SearchableText
parameter it will be converted to an embedding
and compared with all other embeddings in the site. You can set the similarity cut off in the config by specifying minSimilarity
in the embed model settings. Results are automatically ordered by similarity but can be ordered differently when specified.
GET /@search?SearchableText=news* HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImZ1bGxuYW1lIjoiQWRtaW4iLCJpYXQiOjE2NDkzMTI0NDl9.RS1Ny_r0v7vIylFfK6q0JVJrkiDuTOh9iG9IL8xbzAk
Or use the client directly:
import { Client } from '@robgietema/nick';
const cli = Client.initialize({ apiPath: 'http://localhost:8080' });
const login = await cli.login({ username: 'admin', password: 'admin' });
const { data } = await cli.search({
token: login.data.token,
query: {
SearchableText: 'news*',
},
});
Example response:
HTTP/1.1 200 OK
Content-Type: application/json
{
"@id": "http://localhost:8080/@search",
"items": [
{
"@id": "http://localhost:8080/news",
"@type": "Folder",
"title": "News",
"UID": "32215c67-86de-462a-8cc0-eabcd2b39c26",
"path": "/news",
"Description": "News Items",
"Title": "News",
"Subject": null,
"is_folderish": true,
"exclude_from_nav": false,
"Type": "Folder",
"getId": "news",
"Creator": "admin",
"id": "news",
"image_field": "",
"image_scales": {},
"portal_type": "Folder",
"review_state": "published",
"modified": "2022-04-02T20:22:00.000Z",
"Date": "2022-04-02T20:22:00.000Z",
"expires": null,
"created": "2022-04-02T20:22:00.000Z",
"effective": "2022-04-02T20:22:00.000Z",
"getObjSize": 217,
"hasPreviewImage": false,
"listCreators": ["admin"],
"mime_type": null,
"CreationDate": "2022-04-02T20:22:00.000Z",
"EffectiveDate": "2022-04-02T20:22:00.000Z",
"ExpirationDate": null,
"ModificationDate": "2022-04-02T20:22:00.000Z",
"similarity": 0.8177864416434183
}
],
"items_total": 1
}