CmsSearchManager$CmsSearchOfflineHandler
Code IndexAdd Codota to your IDE (free)

Best Java code snippets using org.opencms.search.CmsSearchManager$CmsSearchOfflineHandler (Showing top 10 results out of 315)

origin: org.opencms/opencms-solr

/**
 * Default constructor when called as cron job.<p>
 */
public CmsSearchManager() {
  m_documentTypes = new HashMap<String, I_CmsDocumentFactory>();
  m_documentTypeConfigs = new ArrayList<CmsSearchDocumentType>();
  m_analyzers = new HashMap<Locale, CmsSearchAnalyzer>();
  m_indexes = new ArrayList<CmsSearchIndex>();
  m_indexSources = new TreeMap<String, CmsSearchIndexSource>();
  m_offlineHandler = new CmsSearchOfflineHandler();
  m_extractionCacheMaxAge = DEFAULT_EXTRACTION_CACHE_MAX_AGE;
  m_maxExcerptLength = DEFAULT_EXCERPT_LENGTH;
  m_offlineUpdateFrequency = DEFAULT_OFFLINE_UPDATE_FREQNENCY;
  m_maxModificationsBeforeCommit = DEFAULT_MAX_MODIFICATIONS_BEFORE_COMMIT;
  m_fieldConfigurations = new HashMap<String, CmsSearchFieldConfiguration>();
  // make sure we have a "standard" field configuration
  addFieldConfiguration(CmsSearchFieldConfiguration.DEFAULT_STANDARD);
  if (CmsLog.INIT.isInfoEnabled()) {
    CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_START_SEARCH_CONFIG_0));
  }
}
origin: org.opencms/opencms-core

  /**
   * Updates all offline indexes for the given list of {@link CmsResource} objects.<p>
   *
   * @param resources a list of {@link CmsResource} objects to update in the offline indexes
   */
  protected synchronized void reIndexResources(List<CmsResource> resources) {
    List<CmsPublishedResource> resourcesToIndex = new ArrayList<CmsPublishedResource>(resources.size());
    for (CmsResource res : resources) {
      CmsPublishedResource pubRes = new CmsPublishedResource(res);
      resourcesToIndex.add(pubRes);
    }
    if (resourcesToIndex.size() > 0) {
      // add the resources found to the offline index thread
      addResourcesToIndex(resourcesToIndex);
    }
  }
}
origin: org.opencms/opencms-core

/**
 * Initialize the offline index handler, require after an offline index has been added.<p>
 */
public void initOfflineIndexes() {
  // check which indexes are configured as offline indexes
  List<CmsSearchIndex> offlineIndexes = new ArrayList<CmsSearchIndex>();
  Iterator<CmsSearchIndex> i = m_indexes.iterator();
  while (i.hasNext()) {
    CmsSearchIndex index = i.next();
    if (CmsSearchIndex.REBUILD_MODE_OFFLINE.equals(index.getRebuildMode())) {
      // this is an offline index
      offlineIndexes.add(index);
    }
  }
  m_offlineIndexes = offlineIndexes;
  m_offlineHandler.initialize();
}
origin: org.opencms/opencms-solr

/**
 * Initialize the offline index handler, require after an offline index has been added.<p>
 */
public void initOfflineIndexes() {
  // check which indexes are configured as offline indexes
  List<CmsSearchIndex> offlineIndexes = new ArrayList<CmsSearchIndex>();
  Iterator<CmsSearchIndex> i = m_indexes.iterator();
  while (i.hasNext()) {
    CmsSearchIndex index = i.next();
    if (CmsSearchIndex.REBUILD_MODE_OFFLINE.equals(index.getRebuildMode())) {
      // this is an offline index
      offlineIndexes.add(index);
    }
  }
  m_offlineIndexes = offlineIndexes;
  m_offlineHandler.initialize();
}
origin: org.opencms/opencms-core

/**
 * Default constructor when called as cron job.<p>
 */
public CmsSearchManager() {
  m_documentTypes = new HashMap<String, I_CmsDocumentFactory>();
  m_documentTypeConfigs = new ArrayList<CmsSearchDocumentType>();
  m_analyzers = new HashMap<Locale, CmsSearchAnalyzer>();
  m_indexes = new ArrayList<CmsSearchIndex>();
  m_indexSources = new TreeMap<String, CmsSearchIndexSource>();
  m_offlineHandler = new CmsSearchOfflineHandler();
  m_extractionCacheMaxAge = DEFAULT_EXTRACTION_CACHE_MAX_AGE;
  m_maxExcerptLength = DEFAULT_EXCERPT_LENGTH;
  m_offlineUpdateFrequency = DEFAULT_OFFLINE_UPDATE_FREQNENCY;
  m_maxIndexWaitTime = DEFAULT_MAX_INDEX_WAITTIME;
  m_maxModificationsBeforeCommit = DEFAULT_MAX_MODIFICATIONS_BEFORE_COMMIT;
  m_fieldConfigurations = new HashMap<String, CmsSearchFieldConfiguration>();
  // make sure we have a "standard" field configuration
  addFieldConfiguration(CmsLuceneFieldConfiguration.DEFAULT_STANDARD);
  if (CmsLog.INIT.isInfoEnabled()) {
    CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_START_SEARCH_CONFIG_0));
  }
}
origin: org.opencms/opencms-solr

  /**
   * Updates all offline indexes for the given list of {@link CmsResource} objects.<p>
   * 
   * @param resources a list of {@link CmsResource} objects to update in the offline indexes
   */
  protected synchronized void reIndexResources(List<CmsResource> resources) {
    List<CmsPublishedResource> resourcesToIndex = new ArrayList<CmsPublishedResource>(resources.size());
    Iterator<CmsResource> r = resources.iterator();
    while (r.hasNext()) {
      CmsResource res = r.next();
      CmsPublishedResource pubRes = new CmsPublishedResource(res);
      resourcesToIndex.add(pubRes);
    }
    if (resourcesToIndex.size() > 0) {
      // add the resources found to the offline index thread
      addResourcesToIndex(resourcesToIndex);
    }
  }
}
origin: org.opencms/opencms-core

/**
 * Obtains the list of resource to update in the offline index,
 * then optimizes the list by removing duplicate entries.<p>
 *
 * @return the list of resource to update in the offline index
 */
protected List<CmsPublishedResource> getResourcesToIndex() {
  List<CmsPublishedResource> resourcesToIndex = m_handler.getResourcesToIndex();
  List<CmsPublishedResource> result = new ArrayList<CmsPublishedResource>(resourcesToIndex.size());
  // Reverse to always keep the last list entries
  Collections.reverse(resourcesToIndex);
  for (CmsPublishedResource pubRes : resourcesToIndex) {
    boolean addResource = true;
    for (CmsPublishedResource resRes : result) {
      if (pubRes.equals(resRes)
        && (pubRes.getState() == resRes.getState())
        && (pubRes.getMovedState() == resRes.getMovedState())
        && pubRes.getRootPath().equals(resRes.getRootPath())) {
        // resource already in the update list
        addResource = false;
        break;
      }
    }
    if (addResource) {
      result.add(pubRes);
    }
  }
  Collections.reverse(result);
  return changeStateOfMoveOriginsToDeleted(result);
}
origin: org.opencms/opencms-solr

/**
 * Implements the event listener of this class.<p>
 * 
 * @see org.opencms.main.I_CmsEventListener#cmsEvent(org.opencms.main.CmsEvent)
 */
public void cmsEvent(CmsEvent event) {
  switch (event.getType()) {
    case I_CmsEventListener.EVENT_PROPERTY_MODIFIED:
    case I_CmsEventListener.EVENT_RESOURCE_CREATED:
    case I_CmsEventListener.EVENT_RESOURCE_AND_PROPERTIES_MODIFIED:
    case I_CmsEventListener.EVENT_RESOURCE_MODIFIED:
      // a resource has been modified - offline indexes require (re)indexing
      List<CmsResource> resources = Collections.singletonList((CmsResource)event.getData().get(
        I_CmsEventListener.KEY_RESOURCE));
      reIndexResources(resources);
      break;
    case I_CmsEventListener.EVENT_RESOURCES_AND_PROPERTIES_MODIFIED:
    case I_CmsEventListener.EVENT_RESOURCE_MOVED:
    case I_CmsEventListener.EVENT_RESOURCE_DELETED:
    case I_CmsEventListener.EVENT_RESOURCE_COPIED:
    case I_CmsEventListener.EVENT_RESOURCES_MODIFIED:
      // a list of resources has been modified - offline indexes require (re)indexing
      reIndexResources((List<CmsResource>)event.getData().get(I_CmsEventListener.KEY_RESOURCES));
      break;
    default:
      // no operation
  }
}
origin: org.opencms/opencms-solr

/**
 * Obtains the list of resource to update in the offline index, 
 * then optimizes the list by removing duplicate entries.<p>
 * 
 * @return the list of resource to update in the offline index
 */
protected List<CmsPublishedResource> getResourcesToIndex() {
  List<CmsPublishedResource> resourcesToIndex = m_handler.getResourcesToIndex();
  List<CmsPublishedResource> result = new ArrayList<CmsPublishedResource>(resourcesToIndex.size());
  Iterator<CmsPublishedResource> i = resourcesToIndex.iterator();
  while (i.hasNext()) {
    Object o = i.next();
    CmsPublishedResource pubRes = (CmsPublishedResource)o;
    int pos = result.indexOf(pubRes);
    if (pos < 0) {
      // resource not already contained in the update list
      result.add(pubRes);
    } else {
      CmsPublishedResource curRes = result.get(pos);
      if ((pubRes.getState() != curRes.getState())
        || (pubRes.getMovedState() != curRes.getMovedState())
        || !pubRes.getRootPath().equals(curRes.getRootPath())) {
        // resource already in the update list but new state is different, so also add this
        result.add(pubRes);
      }
    }
  }
  return result;
}
origin: org.opencms/opencms-core

  reIndexResources(resources);
  break;
case I_CmsEventListener.EVENT_RESOURCE_DELETED:
  reIndexResources(resourcesToDelete);
  break;
case I_CmsEventListener.EVENT_RESOURCES_AND_PROPERTIES_MODIFIED:
case I_CmsEventListener.EVENT_RESOURCES_MODIFIED:
  reIndexResources((List<CmsResource>)event.getData().get(I_CmsEventListener.KEY_RESOURCES));
  break;
default:
org.opencms.searchCmsSearchManager$CmsSearchOfflineHandler

Javadoc

Handles offline index generation.

Most used methods

  • <init>
    Initializes the offline index handler.
  • addResourcesToIndex
    Adds a list of CmsPublishedResource objects to be indexed.
  • getResourcesToIndex
    Returns the list of CmsPublishedResource objects to index.
  • initialize
    Initializes this offline search handler, registering the event handlers if required.
  • reIndexResources
    Updates all offline indexes for the given list of CmsResource objects.

Popular in Java

  • Finding current android device location
  • getResourceAsStream (ClassLoader)
  • onRequestPermissionsResult (Fragment)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,

For IntelliJ IDEA,
Android Studio or Eclipse

  • Search for JavaScript code betaCodota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutBlogContact Us
  • Plugin user guideTerms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)