Package org.hibernate.search.engine

Examples of org.hibernate.search.engine.DocumentBuilder$PropertiesMetadata


    }
    else {
      Set<Class> involvedClasses = new HashSet<Class>( classes.length );
      Collections.addAll( involvedClasses, classes );
      for (Class clazz : classes) {
        DocumentBuilder builder = builders.get( clazz );
        if ( builder != null ) involvedClasses.addAll( builder.getMappedSubclasses() );
      }
      for (Class clazz : involvedClasses) {
        DocumentBuilder builder = builders.get( clazz );
        //TODO should we rather choose a polymorphic path and allow non mapped entities
        if ( builder == null )
          throw new HibernateException( "Not a mapped entity (don't forget to add @Indexed): " + clazz );
        final DirectoryProvider[] directoryProviders =
            builder.getDirectoryProviderSelectionStrategy().getDirectoryProvidersForAllShards();
        for (DirectoryProvider provider : directoryProviders) {
          if ( !directories.contains( provider ) ) {
            directories.add( provider );
          }
        }
View Full Code Here


    workspace = new Workspace( searchFactoryImplementor );
    worker = new LuceneWorker( workspace );
    try {
      List<LuceneWorker.WorkWithPayload> queueWithFlatDPs = new ArrayList<LuceneWorker.WorkWithPayload>( queue.size()*2 );
      for ( LuceneWork work : queue ) {
        DocumentBuilder documentBuilder = searchFactoryImplementor.getDocumentBuilders().get( work.getEntityClass() );
        IndexShardingStrategy shardingStrategy = documentBuilder.getDirectoryProviderSelectionStrategy();

        if ( PurgeAllLuceneWork.class.isAssignableFrom( work.getClass() ) ) {
          DirectoryProvider[] providers = shardingStrategy.getDirectoryProvidersForDeletion(
              work.getEntityClass(),
              work.getId(),
View Full Code Here

      {
         Set<Class> involvedClasses = new HashSet<Class>(classes.length);
         Collections.addAll(involvedClasses, classes);
         for (Class clazz : classes)
         {
            DocumentBuilder builder = builders.get(clazz);
            if (builder != null) involvedClasses.addAll(builder.getMappedSubclasses());
         }

         for (Class clazz : involvedClasses)
         {
            DocumentBuilder builder = builders.get(clazz);
            if (builder == null)
            {
               throw new HibernateException("Not a mapped entity (don't forget to add @Indexed): " + clazz);
            }

            final DirectoryProvider[] directoryProviders = builder.getDirectoryProviderSelectionStrategy().getDirectoryProvidersForAllShards();
            searcherSimilarity = checkSimilarity(searcherSimilarity, builder);
            populateDirectories(directories, directoryProviders);
         }
         classesAndSubclasses = involvedClasses;
      }
View Full Code Here

        operations++; //estimate the number of modifications done on this index
      }
      if ( writer != null ) return writer;
      lock();
      try {
        DocumentBuilder documentBuilder = searchFactoryImplementor.getDocumentBuilders().get( entity );
        Analyzer analyzer = entity != null ?
            documentBuilder.getAnalyzer() :
            SIMPLE_ANALYZER; //never used
        writer = new IndexWriter( directoryProvider.getDirectory(), analyzer, false ); //has been created at init time
        if ( entity != null ) {
          writer.setSimilarity( documentBuilder.getSimilarity() );
        }
        LuceneIndexingParameters indexingParams = searchFactoryImplementor.getIndexingParameters( directoryProvider );
        indexingParams.applyToWriter( writer, isBatch );
      }
      catch (IOException e) {
View Full Code Here

    workspace = new Workspace( searchFactoryImplementor );
    worker = new LuceneWorker( workspace );
    try {
      List<LuceneWorker.WorkWithPayload> queueWithFlatDPs = new ArrayList<LuceneWorker.WorkWithPayload>( queue.size()*2 );
      for ( LuceneWork work : queue ) {
        DocumentBuilder documentBuilder = searchFactoryImplementor.getDocumentBuilders().get( work.getEntityClass() );
        IndexShardingStrategy shardingStrategy = documentBuilder.getDirectoryProviderSelectionStrategy();

        if ( PurgeAllLuceneWork.class.isAssignableFrom( work.getClass() ) ) {
          DirectoryProvider[] providers = shardingStrategy.getDirectoryProvidersForDeletion(
              work.getEntityClass(),
              work.getId(),
View Full Code Here

     * even with Lucene 2.1, use of indexWriter to delete is not an option
     * We can only delete by term, and the index doesn't have a termt that
     * uniquely identify the entry. See logic below
     */
    log.trace( "remove from Lucene index: {}#{}", entity, id );
    DocumentBuilder builder = workspace.getDocumentBuilder( entity );
    Term term = builder.getTerm( id );
    IndexReader reader = workspace.getIndexReader( provider, entity );
    TermDocs termDocs = null;
    try {
      //TODO is there a faster way?
      //TODO include TermDocs into the workspace?
View Full Code Here

    }
    else {
      Set<Class> involvedClasses = new HashSet<Class>( classes.length );
      Collections.addAll( involvedClasses, classes );
      for ( Class clazz : classes ) {
        DocumentBuilder builder = builders.get( clazz );
        if ( builder != null ) involvedClasses.addAll( builder.getMappedSubclasses() );
      }
      for ( Class clazz : involvedClasses ) {
        DocumentBuilder builder = builders.get( clazz );
        //TODO should we rather choose a polymorphic path and allow non mapped entities
        if ( builder == null ) throw new HibernateException( "Not a mapped entity: " + clazz );
        directories.add( builder.getDirectoryProvider().getDirectory() );
      }
      classesAndSubclasses = involvedClasses;
    }

    //set up the searcher
View Full Code Here

    remove( entity, id );
  }

  private void remove(Class entity, Serializable id) {
    log.trace( "remove from Lucene index: " + entity + "#" + id );
    DocumentBuilder builder = workspace.getDocumentBuilder( entity );
    Term term = builder.getTerm( id );
    IndexReader reader = workspace.getIndexReader( entity );
    TermDocs termDocs = null;
    try {
      //TODO is there a faster way?
      //TODO include TermDocs into the workspace?
View Full Code Here

      {
         Set<Class> involvedClasses = new HashSet<Class>(classes.length);
         Collections.addAll(involvedClasses, classes);
         for (Class clazz : classes)
         {
            DocumentBuilder builder = builders.get(clazz);
            if (builder != null) involvedClasses.addAll(builder.getMappedSubclasses());
         }

         for (Class clazz : involvedClasses)
         {
            DocumentBuilder builder = builders.get(clazz);
            if (builder == null)
            {
               throw new HibernateException("Not a mapped entity (don't forget to add @Indexed): " + clazz);
            }

            final DirectoryProvider[] directoryProviders = builder.getDirectoryProviderSelectionStrategy().getDirectoryProvidersForAllShards();
            searcherSimilarity = checkSimilarity(searcherSimilarity, builder);
            populateDirectories(directories, directoryProviders);
         }
         classesAndSubclasses = involvedClasses;
      }
View Full Code Here

    }
    else {
      Set<Class> involvedClasses = new HashSet<Class>( classes.length );
      Collections.addAll( involvedClasses, classes );
      for (Class clazz : classes) {
        DocumentBuilder builder = builders.get( clazz );
        if ( builder != null ) involvedClasses.addAll( builder.getMappedSubclasses() );
      }

      for (Class clazz : involvedClasses) {
        DocumentBuilder builder = builders.get( clazz );
        //TODO should we rather choose a polymorphic path and allow non mapped entities
        if ( builder == null )
          throw new HibernateException( "Not a mapped entity (don't forget to add @Indexed): " + clazz );

        final DirectoryProvider[] directoryProviders = builder.getDirectoryProviderSelectionStrategy().getDirectoryProvidersForAllShards();
        searcherSimilarity = checkSimilarity( searcherSimilarity, builder );
        populateDirectories( directories, directoryProviders, searchFactoryImplementor );
      }
      classesAndSubclasses = involvedClasses;
    }
View Full Code Here

TOP

Related Classes of org.hibernate.search.engine.DocumentBuilder$PropertiesMetadata

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.