07-28-2022 02:57 AM
Hi there,
I'm new to Alfresco development so please, bare with me.
I post the following body to the search api (using postman)
{ "query": { "language": "afts", "userQuery": null, "query": "+TYPE:\"cm:content\" AND content.mimetype:\"image/vnd.dwg\" AND ANCESTOR:\"workspace://SpacesStore/7e369873-7b19-4d0d-bc8e-fab2b50ca641\"" }, "paging": { "maxItems": 25, "skipCount": 0 }, "include": null, "includeRequest": false, "fields": [ "cm:description", "cm:title", "cm:versionLabel" ], "sort": [ { "type": "FIELD", "field": "cm:name", "ascending": true } ], "templates": null, "defaults": null, "localization": { "timezone": null, "locales": [ "en-US" ] }, "filterQueries": null, "facetQueries": null, "facetFields": null, "facetIntervals": null, "pivots": null, "stats": null, "spellcheck": null, "scope": null, "limits": null, "highlight": null, "ranges": null }
and I get
{ "list": { "pagination": { "count": 4, "hasMoreItems": false, "totalItems": 4, "skipCount": 0, "maxItems": 25 }, "context": { "consistency": { "lastTxId": 348 } }, "entries": [ { "entry": {} }, { "entry": {} }, { "entry": {} }, { "entry": {} } ] } }
As you can see, I get empty entries.
Now, if I remove the fields frommy qury, then I get the result expected.
However, I need to get those properties in the result.
Any idea?
08-01-2022 03:58 AM
Forget it, I found the solution.
In stead of defineing the fields, I just needed to include the properties. The right query body would now look like
{ "query": { "language": "afts", "userQuery": null, "query": "+TYPE:\"cm:content\" AND content.mimetype:\"image/vnd.dwg\" AND ANCESTOR:\"workspace://SpacesStore/7e369873-7b19-4d0d-bc8e-fab2b50ca641\"" }, "paging": { "maxItems": 25, "skipCount": 0 }, "include": [ "properties" ], "includeRequest": false, "fields": null, "sort": [ { "type": "FIELD", "field": "cm:name", "ascending": true } ], "templates": null, "defaults": null, "localization": { "timezone": null, "locales": [ "en-US" ] }, "filterQueries": null, "facetQueries": null, "facetFields": null, "facetIntervals": null, "pivots": null, "stats": null, "spellcheck": null, "scope": null, "limits": null, "highlight": null, "ranges": null }
08-01-2022 12:24 AM
I forgot to mention that I'm using the Community edition version 7.2 is that can make a difference....
08-01-2022 03:58 AM
Forget it, I found the solution.
In stead of defineing the fields, I just needed to include the properties. The right query body would now look like
{ "query": { "language": "afts", "userQuery": null, "query": "+TYPE:\"cm:content\" AND content.mimetype:\"image/vnd.dwg\" AND ANCESTOR:\"workspace://SpacesStore/7e369873-7b19-4d0d-bc8e-fab2b50ca641\"" }, "paging": { "maxItems": 25, "skipCount": 0 }, "include": [ "properties" ], "includeRequest": false, "fields": null, "sort": [ { "type": "FIELD", "field": "cm:name", "ascending": true } ], "templates": null, "defaults": null, "localization": { "timezone": null, "locales": [ "en-US" ] }, "filterQueries": null, "facetQueries": null, "facetFields": null, "facetIntervals": null, "pivots": null, "stats": null, "spellcheck": null, "scope": null, "limits": null, "highlight": null, "ranges": null }
Explore our Alfresco products with the links below. Use labels to filter content by product module.