Package org.rssowl.core.persist.service

Examples of org.rssowl.core.persist.service.IModelSearch


   */
  public void updateSavedSearches(Set<ISearchMark> searchMarks, boolean fromUserEvent) {
    boolean firstUpdate = !fUpdatedOnce.get();

    fUpdatedOnce.set(true);
    IModelSearch modelSearch = Owl.getPersistenceService().getModelSearch();
    Set<SearchMarkEvent> events = new HashSet<SearchMarkEvent>(searchMarks.size());

    /* For each Search Mark */
    for (ISearchMark searchMark : searchMarks) {

      /* Execute the search */
      List<SearchHit<NewsReference>> results = modelSearch.searchNews(searchMark.getSearchConditions(), searchMark.matchAllConditions());

      /* Fill Result into Buckets */
      List<NewsReference> readNews = Collections.emptyList();
      List<NewsReference> unreadNews = Collections.emptyList();
      List<NewsReference> newNews = Collections.emptyList();
View Full Code Here


   * @param searchMarks The Set of <code>ISearchMark</code> to update the
   * results in.
   */
  public void updateSavedSearches(Set<ISearchMark> searchMarks) {
    fUpdatedOnce.set(true);
    IModelSearch modelSearch = Owl.getPersistenceService().getModelSearch();
    Set<SearchMarkEvent> events = new HashSet<SearchMarkEvent>(searchMarks.size());

    /* For each Search Mark */
    for (ISearchMark searchMark : searchMarks) {

      /* Execute the search */
      List<SearchHit<NewsReference>> results = modelSearch.searchNews(searchMark.getSearchConditions(), searchMark.matchAllConditions());

      /* Fill Result into Buckets */
      List<NewsReference> readNews = Collections.emptyList();
      List<NewsReference> unreadNews = Collections.emptyList();
      List<NewsReference> newNews = Collections.emptyList();
View Full Code Here

      /*
       * If reindexRequired is true, subMonitor is guaranteed to be non-null,
       * but we have the check anyway to
       */
      if (subMonitor != null && reindexRequired) {
        IModelSearch modelSearch = InternalOwl.getDefault().getPersistenceService().getModelSearch();
        modelSearch.startup();
        modelSearch.reindexAll(subMonitor.newChild(90));
      }
    } finally {
      /*
       * If we perform the migration, the subMonitor is not null. Otherwise we
       * don't show progress.
View Full Code Here

   */
  public void updateSavedSearches(Collection<ISearchMark> searchMarks, boolean fromUserEvent) {
    boolean firstUpdate = !fUpdatedOnce.get();

    fUpdatedOnce.set(true);
    IModelSearch modelSearch = Owl.getPersistenceService().getModelSearch();
    Set<SearchMarkEvent> events = new HashSet<SearchMarkEvent>(searchMarks.size());

    /* For each Search Mark */
    for (ISearchMark searchMark : searchMarks) {

      /* Return early if shutting down */
      if (Controller.getDefault().isShuttingDown())
        return;

      /* Execute the search */
      List<SearchHit<NewsReference>> results = modelSearch.searchNews(searchMark.getSearchConditions(), searchMark.matchAllConditions());

      /* Fill Result into Map Buckets */
      Map<INews.State, List<NewsReference>> resultsMap = new EnumMap<INews.State, List<NewsReference>>(INews.State.class);

      Set<State> visibleStates = INews.State.getVisible();
View Full Code Here

      if (subMonitor == null && shouldReindex) {
        progressMonitor.beginLongOperation(false);
        subMonitor = SubMonitor.convert(progressMonitor, Messages.DBManager_PROGRESS_WAIT, 20);
      }

      IModelSearch modelSearch = InternalOwl.getDefault().getPersistenceService().getModelSearch();
      if (!progressMonitor.isCanceled() && (shouldReindex || migrationResult.isOptimizeIndex())) {
        modelSearch.startup();
        if (shouldReindex && !progressMonitor.isCanceled()) {
          Activator.safeLogInfo("Start: Search Re-Indexing"); //$NON-NLS-1$

          File marker = getReindexMarkerFile();
          try {

            /* Create Marker that Reindexing is Performed */
            if (!marker.exists())
              safeCreate(marker);

            /* Reindex Search Index */
            modelSearch.reindexAll(subMonitor != null ? subMonitor.newChild(20) : new NullProgressMonitor());
          } finally {
            safeDelete(marker);
          }

          if (progressMonitor.isCanceled())
            Activator.safeLogInfo("Cancelled: Search Re-Indexing"); //$NON-NLS-1$
          else
            Activator.safeLogInfo("Finished: Search Re-Indexing"); //$NON-NLS-1$
        }

        /* Optimize Index if Necessary */
        if (migrationResult.isOptimizeIndex() && !progressMonitor.isCanceled())
          modelSearch.optimize();
      }
    } finally {
      if (subMonitor != null) //If we perform the migration, the subMonitor is not null. Otherwise we don't show progress.
        progressMonitor.done();
    }
View Full Code Here

      if (forcableActions.isEmpty()) {
        MessageDialog.openWarning(getShell(), NLS.bind(Messages.NewsFiltersListDialog_RUN_SELECTED_FILTER_N, filter.getName()), NLS.bind(Messages.NewsFiltersListDialog_NO_ACTIONS_TO_RUN, filter.getName()));
        return;
      }

      IModelSearch search = Owl.getPersistenceService().getModelSearch();
      List<SearchHit<NewsReference>> targetNews = null;

      /* Search for all Visible News */
      Set<State> visibleStates = INews.State.getVisible();
      if (filter.getSearch() == null) {
        ISearchField stateField = Owl.getModelFactory().createSearchField(INews.STATE, INews.class.getName());
        ISearchCondition stateCondition = Owl.getModelFactory().createSearchCondition(stateField, SearchSpecifier.IS, EnumSet.of(State.NEW, State.UNREAD, State.UPDATED, State.READ));
        targetNews = search.searchNews(Collections.singleton(stateCondition), true);
      }

      /* Use Search from Filter */
      else {
        List<SearchHit<NewsReference>> result = search.searchNews(filter.getSearch());
        targetNews = new ArrayList<SearchHit<NewsReference>>(result.size());

        /* Filter out those that are not visible */
        for (SearchHit<NewsReference> resultItem : result) {
          INews.State state = (State) resultItem.getData(INews.STATE);
View Full Code Here

      if (forcableActions.isEmpty()) {
        MessageDialog.openWarning(getShell(), NLS.bind(Messages.NewsFiltersListDialog_RUN_SELECTED_FILTER_N, filter.getName()), NLS.bind(Messages.NewsFiltersListDialog_NO_ACTIONS_TO_RUN, filter.getName()));
        return;
      }

      IModelSearch search = Owl.getPersistenceService().getModelSearch();
      List<SearchHit<NewsReference>> targetNews = null;

      /* Search for all Visible News */
      Set<State> visibleStates = INews.State.getVisible();
      if (filter.getSearch() == null) {
        ISearchField stateField = Owl.getModelFactory().createSearchField(INews.STATE, INews.class.getName());
        ISearchCondition stateCondition = Owl.getModelFactory().createSearchCondition(stateField, SearchSpecifier.IS, EnumSet.of(State.NEW, State.UNREAD, State.UPDATED, State.READ));
        targetNews = search.searchNews(Collections.singleton(stateCondition), true);
      }

      /* Use Search from Filter */
      else {
        List<SearchHit<NewsReference>> result = search.searchNews(filter.getSearch());
        targetNews = new ArrayList<SearchHit<NewsReference>>(result.size());

        /* Filter out those that are not visible */
        for (SearchHit<NewsReference> resultItem : result) {
          INews.State state = (State) resultItem.getData(INews.STATE);
View Full Code Here

          if (shouldReindex) {
            progressMonitor.beginLongOperation(false);
            subMonitor = SubMonitor.convert(progressMonitor, Messages.DBManager_PROGRESS_WAIT, 20);
          }

          IModelSearch modelSearch = InternalOwl.getDefault().getPersistenceService().getModelSearch();
          if (!progressMonitor.isCanceled() && (shouldReindex || migrationResult.isOptimizeIndex())) {

            /* Reindex */
            if (shouldReindex && !progressMonitor.isCanceled()) {
              Activator.safeLogInfo("Start: Search Re-Indexing"); //$NON-NLS-1$

              File marker = getReindexMarkerFile();
              File reIndexFile = getReIndexFile();
              try {

                /* Create Marker that Reindexing is Performed */
                if (!marker.exists())
                  safeCreate(marker);

                /* Reindex Search Index */
                reindexed = true;
                modelSearch.reindexAll(subMonitor != null ? subMonitor.newChild(20) : new NullProgressMonitor());

                /*
                 * Make sure to delete the reindex file if existing only after
                 * the operation has completed without issues to ensure that
                 * upon next start the reindexing is started again if it failed
                 * prior.
                 */
                if (reIndexFile.exists())
                  safeDelete(reIndexFile);
              } finally {
                safeDelete(marker);
              }

              /* Log Status */
              Activator.safeLogInfo("Finished: Search Re-Indexing"); //$NON-NLS-1$
            }
          }
        }

        /* Clean-Up Search Index if necessary */
        File cleanUpIndexFile = getCleanUpIndexFile();
        if (!reindexed && cleanUpIndexFile.exists() && !progressMonitor.isCanceled()) {

          /* Report Progress */
          progressMonitor.beginLongOperation(false);
          subMonitor = SubMonitor.convert(progressMonitor, Messages.DBManager_PROGRESS_WAIT, 20);

          /* Startup Model Search to perform operation */
          IModelSearch modelSearch = InternalOwl.getDefault().getPersistenceService().getModelSearch();
          modelSearch.startup();

          /* Trigger Clean Up */
          if (!progressMonitor.isCanceled()) {
            Activator.safeLogInfo("Start: Search Clean-Up"); //$NON-NLS-1$
            modelSearch.cleanUp(subMonitor != null ? subMonitor.newChild(20) : new NullProgressMonitor());

            /* Delete the Marker */
            safeDelete(cleanUpIndexFile);

            /* Log Status */
 
View Full Code Here

   */
  public void updateSavedSearches(Collection<ISearchMark> searchMarks, boolean fromUserEvent) {
    boolean firstUpdate = !fUpdatedOnce.get();

    fUpdatedOnce.set(true);
    IModelSearch modelSearch = Owl.getPersistenceService().getModelSearch();
    Set<SearchMarkEvent> events = new HashSet<SearchMarkEvent>(searchMarks.size());

    /* For each Search Mark */
    for (ISearchMark searchMark : searchMarks) {

      /* Return early if shutting down */
      if (Controller.getDefault().isShuttingDown())
        return;

      /* Execute the search */
      List<SearchHit<NewsReference>> results = modelSearch.searchNews(searchMark.getSearchConditions(), searchMark.matchAllConditions());

      /* Fill Result into Map Buckets */
      Map<INews.State, List<NewsReference>> resultsMap = new EnumMap<INews.State, List<NewsReference>>(INews.State.class);

      Set<State> visibleStates = INews.State.getVisible();
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.service.IModelSearch

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.