@Override
  public ContentDocument getContentDocumentById(String id, String relativizer, Locale locale) {
    Navigation navigation = this.getNavigation(locale);

    // check if the document exists
    NavigationElement navigationElement = navigation.getNavigationElementByDocumentId(id);
    if (navigationElement == null || StringUtils.isEmpty(navigationElement.getDocumentId())) {
      return null;
    }

    Map<String, String> linkTranslationMap = navigation.getLinkTranslationMap();
    return this.getContentDocument(id, locale, relativizer, linkTranslationMap);
  }
  @Override
  public ContentDocument getContentDocumentByPath(String path, Locale locale) {
    Navigation navigation = this.getNavigation(locale);

    NavigationElement navigationElement = navigation.getNavigationElementByPath(path);
    if (navigationElement == null || StringUtils.isEmpty(navigationElement.getDocumentId())) {
      return null;
    }

    Map<String, String> linkTranslationMap = navigation.getLinkTranslationMap();
    return this.getContentDocument(
        navigationElement.getDocumentId(), locale, createRelativizer(path), linkTranslationMap);
  }
  @Override
  public List<ContentDocument> find(String query, Locale locale) {
    List<String> docIds = this.contentDocumentDao.find(query, locale);

    // check if the result documents is part of the navigation
    List<String> existingDocIds = new ArrayList<String>();
    Navigation navigation = this.getNavigation(locale);
    for (String docId : docIds) {
      NavigationElement navigationElement = navigation.getNavigationElementByDocumentId(docId);

      if (navigationElement != null && StringUtils.isNotEmpty(navigationElement.getDocumentId())) {
        existingDocIds.add(docId);
      }
    }

    // load the document
    List<ContentDocument> results = new ArrayList<ContentDocument>();
    for (String documentId : existingDocIds) {
      results.add(this.getContentDocument(documentId, locale, "", null));
    }

    return results;
  }