Package org.hibernate.search.query.engine.spi

Examples of org.hibernate.search.query.engine.spi.DocumentExtractor


      if (fetchOptions.getFetchMode() == FetchOptions.FetchMode.EAGER) {
         hSearchQuery.getTimeoutManager().start();
         List<EntityInfo> entityInfos = hSearchQuery.queryEntityInfos();
         return filterNulls(new EagerIterator(entityInfos, getResultLoader(), fetchOptions.getFetchSize()));
      } else if (fetchOptions.getFetchMode() == FetchOptions.FetchMode.LAZY) {
         DocumentExtractor extractor = hSearchQuery.queryDocumentExtractor();   //triggers actual Lucene search
         return filterNulls(new LazyIterator(extractor, getResultLoader(), fetchOptions.getFetchSize()));
      } else {
         throw new IllegalArgumentException("Unknown FetchMode " + fetchOptions.getFetchMode());
      }
   }
View Full Code Here


      facets = facetResults.get( facetingName );
    }
    if ( facets != null ) {
      return facets;
    }
    DocumentExtractor queryDocumentExtractor = query.queryDocumentExtractor();
    queryDocumentExtractor.close();
    //handle edge case of an empty index
    if ( facetResults == null ) {
      return Collections.emptyList();
    }
    List<Facet> results = facetResults.get( facetingName );
View Full Code Here

      int first = getFirstResultIndex();
      int max = max( first, queryHits.getTotalHits() );

      int size = max - first + 1 < 0 ? 0 : max - first + 1;
      List<EntityInfo> infos = new ArrayList<EntityInfo>( size );
      DocumentExtractor extractor = buildDocumentExtractor( searcher, queryHits, first, max );
      for ( int index = first; index <= max; index++ ) {
        infos.add( extractor.extract( index ) );
        //TODO should we measure on each extractor?
        if ( index % 10 == 0 ) {
          getTimeoutManager().isTimedOut();
        }
      }
View Full Code Here

      int first = getFirstResultIndex();
      int max = max( first, queryHits.getTotalHits() );

      int size = max - first + 1 < 0 ? 0 : max - first + 1;
      List<EntityInfo> infos = new ArrayList<EntityInfo>( size );
      DocumentExtractor extractor = buildDocumentExtractor( searcher, queryHits, first, max );
      for ( int index = first; index <= max; index++ ) {
        infos.add( extractor.extract( index ) );
        //TODO should we measure on each extractor?
        if ( index % 10 == 0 ) {
          getTimeoutManager().isTimedOut();
        }
      }
View Full Code Here

    Set<String> identifiers = new HashSet<String>();
    identifiers.add( "providedId" );
    Set<Class<?>> targetedClasses = new HashSet<Class<?>>();
    targetedClasses.add( ProvidedIdPerson.class );
    targetedClasses.add( ProvidedIdPersonSub.class );
    DocumentExtractor extractor = new DocumentExtractorImpl(
        queryHits, sf, new String[] { "name" },
        identifiers, false,
        lowLevelSearcher,
        luceneQuery,
        0, 0, //not used in this case
        targetedClasses
    );
    HashSet<String> titles = new HashSet<String>( 3 );
    for ( int id = 0; id < hits.totalHits; id++ ) {
      Long documentId = (Long) extractor.extract( id ).getId();
      String projectedTitle = (String) extractor.extract( id ).getProjection()[0];
      assertNotNull( projectedTitle );
      titles.add( projectedTitle );
    }
    assertTrue( titles.contains( "Regular goat" ) );
    assertTrue( titles.contains( "Mini Goat" ) );
View Full Code Here

      int first = getFirstResultIndex();
      int max = max( first, queryHits.getTotalHits() );

      int size = max - first + 1 < 0 ? 0 : max - first + 1;
      List<EntityInfo> infos = new ArrayList<EntityInfo>( size );
      DocumentExtractor extractor = buildDocumentExtractor( searcher, queryHits, first, max );
      for ( int index = first; index <= max; index++ ) {
        infos.add( extractor.extract( index ) );
        //TODO should we measure on each extractor?
        if ( index % 10 == 0 ) {
          getTimeoutManager().isTimedOut();
        }
      }
View Full Code Here

      int first = getFirstResultIndex();
      int max = max( first, queryHits.getTotalHits() );

      int size = max - first + 1 < 0 ? 0 : max - first + 1;
      List<EntityInfo> infos = new ArrayList<EntityInfo>( size );
      DocumentExtractor extractor = buildDocumentExtractor( searcher, queryHits, first, max );
      for ( int index = first; index <= max; index++ ) {
        infos.add( extractor.extract( index ) );
        //TODO should we measure on each extractor?
        if ( index % 10 == 0 ) {
          getTimeoutManager().isTimedOut();
        }
      }
View Full Code Here

      int first = getFirstResultIndex();
      int max = max( first, queryHits.getTotalHits() );

      int size = max - first + 1 < 0 ? 0 : max - first + 1;
      List<EntityInfo> infos = new ArrayList<EntityInfo>( size );
      DocumentExtractor extractor = buildDocumentExtractor( searcher, queryHits, first, max );
      for ( int index = first; index <= max; index++ ) {
        infos.add( extractor.extract( index ) );
        //TODO should we measure on each extractor?
        if ( index % 10 == 0 ) {
          getTimeoutManager().isTimedOut();
        }
      }
View Full Code Here

      facets = facetResults.get( facetingName );
    }
    if ( facets != null ) {
      return facets;
    }
    DocumentExtractor queryDocumentExtractor = query.queryDocumentExtractor();
    queryDocumentExtractor.close();
    //handle edge case of an empty index
    if (facetResults == null) {
      return Collections.emptyList();
    }
    List<Facet> results = facetResults.get( facetingName );
View Full Code Here

      int first = getFirstResultIndex();
      int max = max( first, queryHits.getTotalHits() );

      int size = max - first + 1 < 0 ? 0 : max - first + 1;
      List<EntityInfo> infos = new ArrayList<EntityInfo>( size );
      DocumentExtractor extractor = buildDocumentExtractor( searcher, queryHits, first, max );
      for ( int index = first; index <= max; index++ ) {
        infos.add( extractor.extract( index ) );
        //TODO should we measure on each extractor?
        if ( index % 10 == 0 ) {
          getTimeoutManager().isTimedOut();
        }
      }
View Full Code Here

TOP

Related Classes of org.hibernate.search.query.engine.spi.DocumentExtractor

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.