Book Image

Alfresco CMIS

By : Martin Bergljung
Book Image

Alfresco CMIS

By: Martin Bergljung

Overview of this book

Table of Contents (14 chapters)
Alfresco CMIS
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Searching


To be able to search for content is one of the main requirements you would have on a CMS system library such as OpenCMIS. And, it supports both searching in metadata and a full-text search in content. Before doing any searches, we first need to see which search features are supported by the repository. We want it to support both a metadata search and FTS:

public void searchMetadataAndFTS(Session session) {
  // Check if the repo supports Metadata search and 
  // Full Text Search (FTS)
  RepositoryInfo repoInfo = session.getRepositoryInfo();
  if (repoInfo.getCapabilities().getQueryCapability().equals(
  CapabilityQuery.METADATAONLY)) {
    logger.warn("Repository does not support FTS [repoName=" + 
    repoInfo.getProductName() + "][repoVersion=" + 
    repoInfo.getProductVersion() + "]");
  } else {
    String query = "SELECT * FROM cmis:document WHERE "+
    "cmis:name LIKE 'OpenCMIS%'";
    ItemIterable<QueryResult> searchResult = 
    session.query(query, false);
   ...