AnsweredAssumed Answered

How do I replicate the Alfresco search via API

Question asked by vezance on Dec 29, 2016
Latest reply on Jan 10, 2017 by andy1

I'm using Alfresco Community Edition 5.2 (EA). I'm building a separate front-end for the users to search for documents, and am using the REST APIs to communicate with Alfresco.

I've noticed that the results returned via the REST API (Post > Search) match with the results shown for the same query in the node browser. However, these differ from results shown when searching within Alfresco.

e.g. If I search Alfresco for 'term', I will get documents which contain 'term' across all properties, including name, content and tags. However, if I enter the same query in node browser, or in the API, I only get documents which contain 'term' in their content. Documents which have 'term' in both the title and as tags, but not in the content, are not returned.

Further, the ordering of results returned by the API differs from the order shown in Alfresco, even when sorted by relevance or score.


The query I attempted via the REST API:

  "query": {
    "query": "TERM",
    "language": "afts"

  "sort": [{"type":"FIELD", "field":"relevance", "ascending":"false"}]


I could at least include documents with 'term' in their name by updating the query to:


  "query": {
    "query": "@cm:name:TERM OR TERM"...

However, this still did not consider document tags.

I simply want to ensure that the results which are shown when searching in Alfresco are the same results which are fetched and displayed via API.