Alfresco Document Search Quick Reference

This quick reference guide provides essential search query examples for locating documents within Alfresco using both CMIS and Solr. Whether you're troubleshooting content issues or simply need to find specific files quickly, these queries will help you pinpoint documents by name, creation date, and modification date. The guide includes examples for both CMIS and Solr search syntax, as well as instructions for using the Solr console and POST API for more advanced searches. With this reference at your fingertips, you can efficiently navigate Alfresco's search capabilities and streamline your document management workflows.

Note on CMIS queries

For CMIS queries to work without SOLR, make sure the “Use Database is possible” option is selected under Transactional Query Options in alfresco/s/enterprise/admin/admin-searchservice page as shown below.



Search for documents by name in CMIS

SELECT * FROM cmis:document WHERE cmis:name = 'SVM Test File.docx'


Search for documents by name match in CMIS

The following query doesn’t require SOLR running. Any CMIS option will return the results without SOLR.

SELECT * FROM cmis:document WHERE cmis:name like '%SVM Test File.docx%'


Search for documents by name match in CMIS within a time range

The following query doesn’t require SOLR running. Any CMIS option will return the results without SOLR.

SELECT * FROM cmis:document 
WHERE cmis:name LIKE '%SVM Test File.docx%' 
AND cmis:creationDate >= TIMESTAMP '2024-06-11T00:00:00.000Z' 
AND cmis:creationDate <= TIMESTAMP '2024-06-11T23:59:59.999Z'
OR cmis:lastModificationDate >= TIMESTAMP '2024-06-11T00:00:00.000Z' 
AND cmis:lastModificationDate <= TIMESTAMP '2024-06-11T23:59:59.999Z'


Search for documents by name match in Solr within a time range

@cm\:name:"*SVM Test File.docx*" AND (@cm\:created:["2024-06-11T00:00:00" TO "2024-06-11T23:59:59"] OR @cm\:modified:["2024-06-11T00:00:00" TO "2024-06-11T23:59:59"])


Search for documents by name match in Solr console within a time range

cm:name:"*SVM Test File.docx*" AND (cm:created:["2024-06-11T00:00:00Z" TO "2024-06-11T23:59:59Z"] OR cm:modified:["2024-06-11T00:00:00Z" TO "2024-06-11T23:59:59Z"])


To find more information using DBID, use the following solr console link:

https://a.b.c.143:8983/solr/alfresco/afts?fl=*,[cached]&indent=on&q=DBID:912&wt=json

Search for documents by name match using POST API Lucene within a time range

{
  "query": {
    "query": "cm:name:\"*SVM Test File.docx*\" AND (cm:created:[\"2024-06-11T00:00:00Z\" TO \"2024-06-11T23:59:59Z\"] OR cm:modified:[\"2024-06-11T00:00:00Z\" TO \"2024-06-11T23:59:59Z\"])"
  },
  "include": [
    "aspectNames",
    "properties",
    "isLink",
    "path"
  ],
  "paging": {
    "maxItems": 50,
    "skipCount": 0
  },
  "filterQueries": []
}


Search for documents by name match using POST API CMIS within a time range

Note: This query doesn’t require solr.

{
   "query":{
      "query":"SELECT * FROM cmis:document WHERE cmis:name LIKE '%SVM Test File.docx%' AND cmis:creationDate >= TIMESTAMP '2024-06-11T00:00:00.000Z' AND cmis:creationDate <= TIMESTAMP '2024-06-11T23:59:59.999Z' OR cmis:lastModificationDate >= TIMESTAMP '2024-06-11T00:00:00.000Z' AND cmis:lastModificationDate <= TIMESTAMP '2024-06-11T23:59:59.999Z'",
      "language":"cmis"
   },
  "include": [
    "aspectNames",
    "properties",
    "isLink",
    "path"
  ],
  "paging": {
    "maxItems": 50,
    "skipCount": 0
  },
  "filterQueries": []
}

Post a comment