Package org.hibernate.search.indexes.spi

Examples of org.hibernate.search.indexes.spi.IndexManager


   }

   @Override
   public Object perform(InvocationContext ctx) throws Throwable {
      queryInterceptor.enableClasses(knownIndexedTypes);
      IndexManager indexManager = searchFactory.getIndexManagerHolder().getIndexManager(indexName);
      if (indexManager == null) {
         throw new SearchException("Unknown index referenced");
      }
      List<LuceneWork> luceneWorks = indexManager.getSerializer().toLuceneWorks(this.serializedModel);
      List<LuceneWork> workToApply = transformKeysToStrings(luceneWorks);//idInString field is not serialized, we need to extract it from the key object
      indexManager.performOperations(workToApply, null);
      return Boolean.TRUE; //Return value to be ignored
   }
View Full Code Here


   }

   @Override
   public Object perform(InvocationContext ctx) throws Throwable {
      queryInterceptor.enableClasses(knownIndexedTypes);
      IndexManager indexManager = searchFactory.getIndexManagerHolder().getIndexManager(indexName);
      if (indexManager == null) {
         throw new SearchException("Unknown index referenced");
      }
      List<LuceneWork> luceneWorks = indexManager.getSerializer().toLuceneWorks(this.serializedModel);
      List<LuceneWork> workToApply = transformKeysToStrings(luceneWorks);//idInString field is not serialized, we need to extract it from the key object
      indexManager.performOperations(workToApply, null);
      return Boolean.TRUE; //Return value to be ignored
   }
View Full Code Here

    final NodeSelectorStrategy nodeSelector = selector.getMasterNodeSelector( indexName );
    try {
      //nodeSelector can be null if we receive the message during shutdown
      if ( nodeSelector != null && nodeSelector.isIndexOwnerLocal() ) {
        byte[] serializedQueue = MessageSerializationHelper.extractSerializedQueue( rawBuffer );
        final IndexManager indexManager = context.getAllIndexesManager().getIndexManager( indexName );
        if ( indexManager != null ) {
          final List<LuceneWork> queue = indexManager.getSerializer().toLuceneWorks( serializedQueue );
          applyLuceneWorkLocally( queue, indexManager, message );
        }
        else {
          log.messageReceivedForUndefinedIndex( indexName );
        }
View Full Code Here

    if ( StringHelper.isEmpty( indexManagerImplementationName ) ) {
      return createDefaultIndexManager();
    }
    else {
      String implName = indexManagerImplementationName.trim();
      IndexManager im = fromAlias( implName );
      if ( im == null ) {
        implName = aliasToFQN( implName );
        im = ClassLoaderHelper.instanceFromName( IndexManager.class, implName,
            IndexManagerHolder.class, "index manager" );
      }
      log.indexManagerAliasResolved( indexManagerImplementationName, im.getClass() );
      return im;
    }
  }
View Full Code Here

  private static class AddSelectionDelegate implements StreamingOperationSelectionDelegate {

    @Override
    public final void performStreamOperation(LuceneWork work,
        IndexShardingStrategy shardingStrategy, IndexingMonitor monitor, boolean forceAsync) {
      IndexManager indexManager = shardingStrategy.getIndexManagerForAddition(
          work.getEntityClass(),
          work.getId(),
          work.getIdInString(),
          work.getDocument()
      );
      indexManager.performStreamOperation( work, monitor, forceAsync );
    }
View Full Code Here

    IndexManager[] providers = new IndexManager[nbrOfProviders];
    for ( int index = 0; index < nbrOfProviders; index++ ) {
      String providerName = nbrOfProviders > 1 ?
          directoryProviderName + "." + index :
          directoryProviderName;
      IndexManager indexManager = indexManagersRegistry.get( providerName );
      if ( indexManager == null ) {
        indexManager = createIndexManager( providerName, indexProps[index], context, cfg );
        indexManagersRegistry.put( providerName, indexManager );
      }
      indexManager.addContainedEntity( mappedClass );
      providers[index] = indexManager;
    }

    //define sharding strategy for this entity:
    IndexShardingStrategy shardingStrategy;
View Full Code Here

    manager.setSimilarity( newSimilarity );
  }

  private IndexManager createIndexManager(String indexName, Properties indexProps, WorkerBuildContext context, SearchConfiguration cfg) {
    String indexManagerImplementationName = indexProps.getProperty( Environment.INDEX_MANAGER_IMPL_NAME );
    final IndexManager manager;
    if ( StringHelper.isEmpty( indexManagerImplementationName ) ) {
      manager = cfg.getIndexManagerFactory().createDefaultIndexManager();
    }
    else {
      manager = cfg.getIndexManagerFactory().createIndexManagerByName( indexManagerImplementationName );
    }
    try {
      manager.initialize( indexName, indexProps, context );
      return manager;
    }
    catch (Exception e) {
      throw log.unableToInitializeIndexManager( indexName, e );
    }
View Full Code Here

  private static class AddSelectionDelegate implements ContextAwareSelectionDelegate {

    @Override
    public final void performOperation(LuceneWork work, IndexShardingStrategy shardingStrategy,
        WorkQueuePerIndexSplitter context) {
      IndexManager indexManager = shardingStrategy.getIndexManagerForAddition(
          work.getEntityClass(),
          work.getId(),
          work.getIdInString(),
          work.getDocument()
      );
View Full Code Here

      return;
    }
    final ObjectMessage objectMessage = (ObjectMessage) message;
    final String indexName;
    final List<LuceneWork> queue;
    final IndexManager indexManager;
    SearchFactoryImplementor factory = getSearchFactory().unwrap( SearchFactoryImplementor.class );
    try {
      indexName = objectMessage.getStringProperty( Environment.INDEX_NAME_JMS_PROPERTY );
      indexManager = factory.getIndexManagerHolder().getIndexManager( indexName );
      if ( indexManager == null ) {
        log.messageReceivedForUndefinedIndex( indexName );
        return;
      }
      queue = indexManager.getSerializer().toLuceneWorks( (byte[]) objectMessage.getObject() );
      indexManager.performOperations( queue, null );
    }
    catch (JMSException e) {
      log.unableToRetrieveObjectFromMessage( message.getClass(), e );
      return;
    }
View Full Code Here

  private static class AddSelectionDelegate implements StreamingOperationSelectionDelegate {

    public final void performStreamOperation(LuceneWork work,
        IndexShardingStrategy shardingStrategy, IndexingMonitor monitor, boolean forceAsync) {
      IndexManager indexManager = shardingStrategy.getIndexManagerForAddition(
          work.getEntityClass(),
          work.getId(),
          work.getIdInString(),
          work.getDocument()
      );
      indexManager.performStreamOperation( work, monitor, forceAsync );
    }
View Full Code Here

TOP

Related Classes of org.hibernate.search.indexes.spi.IndexManager

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.