search/indexer/mmm-search-indexer-api/src/main/java/net/sf/mmm/search/indexer/impl/strategy/SearchIndexerUpdateStrategyLastModified.java
/**
   * This method removes all entries from the search-indexer that have NOT been
   * {@link CountingEntryUpdateVisitor#visitIndexedEntryUri(String, net.sf.mmm.util.event.api.ChangeType)
   * visited} during the indexing/crawling.
   *
   * @see #createEntryUpdateVisitor()
   *
   * @param arguments are the {@link UpdateStrategyArguments}.
   */
This method removes all entries from the search-indexer that have NOT been
{@link CountingEntryUpdateVisitor#visitIndexedEntryUri(String, net.sf.mmm.util.event.api.ChangeType)
visited} during the indexing/crawling.



@param arguments are the  UpdateStrategyArguments.
This method removes all entries from the search - indexer that have NOT been { @link CountingEntryUpdateVisitor#visitIndexedEntryUri ( String net . sf . mmm . util . event . api . ChangeType ) visited } during the indexing / crawling . @param arguments are the UpdateStrategyArguments .
protected void removeNotVisitedResourceEntries(UpdateStrategyArguments arguments) {
    SearchIndexer indexer = arguments.getIndexer();
    SearchEngine searchEngine = indexer.getSearchEngine();
    String sourceId = arguments.getSource().getId();
    SearchQuery query = searchEngine.getQueryBuilder().createWordQuery(SearchEntry.FIELD_SOURCE, sourceId);
    int hitsPerPage = Integer.MAX_VALUE;
    SearchResultPage page = searchEngine.search(query, hitsPerPage);
    CountingEntryUpdateVisitorCollector visitor = (CountingEntryUpdateVisitorCollector) arguments.getContext()
        .getVariable(CONTEXT_VARIABLE_ENTRY_UPDATE_VISITOR);
    Set<String> entryUriSet = visitor.getEntryUriSet();
    int hitCount = page.getPageHitCount();
    for (int i = 0; i < hitCount; i++) {
      SearchHit hit = page.getPageHit(i);
      String uri = hit.getUri();
      if (!entryUriSet.contains(uri)) {
        visitor.visitIndexedEntryUri(uri, ChangeType.REMOVE);
        getLogger().debug("Removing " + uri);
        indexer.remove(hit);
      }
    }
  }
protected void removeNotVisitedResourceEntries ( UpdateStrategyArguments arguments ) { SearchIndexer indexer = arguments . getIndexer ( ) ; SearchEngine searchEngine = indexer . getSearchEngine ( ) ; String sourceId = arguments . getSource ( ) . getId ( ) ; SearchQuery query = searchEngine . getQueryBuilder ( ) . createWordQuery ( SearchEntry . FIELD_SOURCE , sourceId ) ; int hitsPerPage = Integer . MAX_VALUE ; SearchResultPage page = searchEngine . search ( query , hitsPerPage ) ; CountingEntryUpdateVisitorCollector visitor = ( CountingEntryUpdateVisitorCollector ) arguments . getContext ( ) . getVariable ( CONTEXT_VARIABLE_ENTRY_UPDATE_VISITOR ) ; Set < String > entryUriSet = visitor . getEntryUriSet ( ) ; int hitCount = page . getPageHitCount ( ) ; for ( int i = 0 ; i < hitCount ; i ++ ) { SearchHit hit = page . getPageHit ( i ) ; String uri = hit . getUri ( ) ; if ( ! entryUriSet . contains ( uri ) ) { visitor . visitIndexedEntryUri ( uri , ChangeType . REMOVE ) ; getLogger ( ) . debug ( "Removing " + uri ) ; indexer . remove ( hit ) ; } } }
This method removes all entries from the search-indexer that have NOT been
 {@link CountingEntryUpdateVisitor#visitIndexedEntryUri(String, net.sf.mmm.util.event.api.ChangeType)
 visited} during the indexing/crawling.
This method removes all entries from the search - indexer that have NOT been { @link CountingEntryUpdateVisitor#visitIndexedEntryUri ( String net . sf . mmm . util . event . api . ChangeType ) visited } during the indexing / crawling .
// delta-indexing: delete entries that have NOT been visited again // would be a lot easier via termDocs(new Term("source", sourceId)); // get all hits... (TODO: use paging...?) // getIndexerDependencies().getResourceSearchIndexer().index(indexer, // null, ChangeType.REMOVE, arguments.getlocation, visitor);