@Override
  public void reindexDDMStructures(List<Long> ddmStructureIds) throws SearchException {

    if (IndexWriterHelperUtil.isIndexReadOnly() || !isIndexerEnabled()) {
      return;
    }

    try {
      Indexer<DLFileEntry> indexer = IndexerRegistryUtil.nullSafeGetIndexer(DLFileEntry.class);

      List<DLFileEntry> dlFileEntries =
          DLFileEntryLocalServiceUtil.getDDMStructureFileEntries(
              ArrayUtil.toLongArray(ddmStructureIds));

      for (DLFileEntry dlFileEntry : dlFileEntries) {
        indexer.reindex(dlFileEntry);
      }
    } catch (Exception e) {
      throw new SearchException(e);
    }
  }
  @Override
  public void reindexDDMStructures(List<Long> ddmStructureIds) throws SearchException {

    if (IndexWriterHelperUtil.isIndexReadOnly() || !isIndexerEnabled()) {
      return;
    }

    try {
      final String[] ddmStructureKeys = new String[ddmStructureIds.size()];

      for (int i = 0; i < ddmStructureIds.size(); i++) {
        long ddmStructureId = ddmStructureIds.get(i);

        DDMStructure ddmStructure = _ddmStructureLocalService.getDDMStructure(ddmStructureId);

        ddmStructureKeys[i] = ddmStructure.getStructureKey();
      }

      final Indexer<JournalArticle> indexer =
          IndexerRegistryUtil.nullSafeGetIndexer(JournalArticle.class);

      final ActionableDynamicQuery actionableDynamicQuery =
          _journalArticleLocalService.getActionableDynamicQuery();

      actionableDynamicQuery.setAddCriteriaMethod(
          new ActionableDynamicQuery.AddCriteriaMethod() {

            @Override
            public void addCriteria(DynamicQuery dynamicQuery) {
              Property ddmStructureKey = PropertyFactoryUtil.forName("DDMStructureKey");

              dynamicQuery.add(ddmStructureKey.in(ddmStructureKeys));

              if (!isIndexAllArticleVersions()) {
                Property statusProperty = PropertyFactoryUtil.forName("status");

                Integer[] statuses = {
                  WorkflowConstants.STATUS_APPROVED, WorkflowConstants.STATUS_IN_TRASH
                };

                dynamicQuery.add(statusProperty.in(statuses));
              }
            }
          });
      actionableDynamicQuery.setPerformActionMethod(
          new ActionableDynamicQuery.PerformActionMethod<JournalArticle>() {

            @Override
            public void performAction(JournalArticle article) throws PortalException {

              try {
                indexer.reindex(indexer.getClassName(), article.getResourcePrimKey());
              } catch (Exception e) {
                throw new PortalException(e);
              }
            }
          });

      actionableDynamicQuery.performActions();
    } catch (Exception e) {
      throw new SearchException(e);
    }
  }