@Override
  public void postProcessSearchQuery(BooleanQuery searchQuery, SearchContext searchContext)
      throws Exception {

    Set<DDMStructure> ddmStructuresSet = new TreeSet<DDMStructure>();

    long[] groupIds = searchContext.getGroupIds();

    if ((groupIds != null) && (groupIds.length > 0)) {
      List<DLFileEntryType> dlFileEntryTypes =
          DLFileEntryTypeLocalServiceUtil.getFileEntryTypes(groupIds);

      for (DLFileEntryType dlFileEntryType : dlFileEntryTypes) {
        ddmStructuresSet.addAll(dlFileEntryType.getDDMStructures());
      }
    }

    Group group = GroupLocalServiceUtil.getCompanyGroup(searchContext.getCompanyId());

    DDMStructure tikaRawMetadataStructure =
        DDMStructureLocalServiceUtil.fetchStructure(
            group.getGroupId(),
            PortalUtil.getClassNameId(RawMetadataProcessor.class),
            "TikaRawMetadata");

    if (tikaRawMetadataStructure != null) {
      ddmStructuresSet.add(tikaRawMetadataStructure);
    }

    for (DDMStructure ddmStructure : ddmStructuresSet) {
      addSearchDDMStruture(searchQuery, searchContext, ddmStructure);
    }

    String keywords = searchContext.getKeywords();

    if (Validator.isNull(keywords)) {
      addSearchTerm(searchQuery, searchContext, Field.DESCRIPTION, false);
      addSearchTerm(searchQuery, searchContext, Field.TITLE, false);
      addSearchTerm(searchQuery, searchContext, Field.USER_NAME, false);
    }

    addSearchTerm(searchQuery, searchContext, "extension", false);
    addSearchTerm(searchQuery, searchContext, "fileEntryTypeId", false);
    addSearchTerm(searchQuery, searchContext, "path", false);

    LinkedHashMap<String, Object> params =
        (LinkedHashMap<String, Object>) searchContext.getAttribute("params");

    if (params != null) {
      String expandoAttributes = (String) params.get("expandoAttributes");

      if (Validator.isNotNull(expandoAttributes)) {
        addSearchExpando(searchQuery, searchContext, expandoAttributes);
      }
    }
  }