03-29-2018 03:57 PM
I am trying to execute a search and retrieve some basic fields. However, there seems to be some naming differences with rest API.
The following request is not returning cm:title field. However, you can see that the field exists and "include properties" is able to return the field.
I tried other conventions as well like, title, @{http://www.alfresco.org/model/content/1.0 }title, @cm:titled.title.
Request:
{
"query": {
"query": "PATH:\"/app:company_home/*\"",
"language": "afts"
},
"paging": {
"skipCount": "0",
"maxItems": "1"
},
"include": [
"properties"
],
"fields": [
"id",
"name",
"cm:title"
],
"sort": [
{
"type": "FIELD",
"field": "cm:created",
"ascending": true
}
]
}
Response:
{
"list": {
"pagination": {
"count": 1,
"hasMoreItems": true,
"totalItems": 7,
"skipCount": 0,
"maxItems": 1
},
"entries": [
{
"entry": {
"name": "Data Dictionary",
"id": "085447d7-146e-45f8-96ef-ffbcd98b82d2",
"properties": {
"cm:title": "Data Dictionary",
"cm:description": "User managed definitions",
"app:icon": "space-icon-default"
}
}
}
]
}
}
04-03-2018 11:31 AM
The following can retrieve the cm:title, however, result is very verbose with unwanted fields and the data is marked with highlights. Any solution?
Request:
{
"query": {
"query": "cm:description:workflow"
},
"paging": {
"skipCount": "0",
"maxItems": "1"
},
"sort": [
{
"type": "FIELD",
"field": "cm:created",
"ascending": false
}
],
"highlight": {
"fields": [
{
"field": "cm:title"
},
{
"field": "cm:description"
}
]
}
}
Response:
{
"list": {
"pagination": {
"count": 1,
"hasMoreItems": true,
"totalItems": 11,
"skipCount": 0,
"maxItems": 1
},
"entries": [
{
"entry": {
"isFile": true,
"createdByUser": {
"id": "System",
"displayName": "System"
},
"modifiedAt": "2018-04-02T15:51:02.267+0000",
"nodeType": "cm:content",
"content": {
"mimeType": "application/x-javascript",
"mimeTypeName": "JavaScript",
"sizeInBytes": 1490,
"encoding": "UTF-8"
},
"parentId": "1fb78a3e-5398-4a72-8c7c-93cb8ae7ccc5",
"createdAt": "2018-04-02T15:51:02.267+0000",
"isFolder": false,
"search": {
"score": 2.0033154,
"highlight": [
{
"field": "cm:title",
"snippets": [
"Start Pooled Review and Approve <em>Workflow</em>"
]
},
{
"field": "cm:description",
"snippets": [
"Starts the Pooled Review and Approve <em>workflow</em> for all members of the site the document belongs to"
]
}
]
},
"modifiedByUser": {
"id": "System",
"displayName": "System"
},
"name": "start-pooled-review-workflow.js",
"location": "nodes",
"id": "9a1332b0-9958-49be-9312-d10ae91527f8"
}
}
]
}
}
04-03-2018 02:51 PM
Looks like rest returns either all properties or no properties. How to customize detailed views in Alfresco search results ?
Can someone confirm this?
Thanks.
Explore our Alfresco products with the links below. Use labels to filter content by product module.