QueryHits queryHits = getQueryHits( searcher, calculateTopDocsRetrievalSize(), true ); final int first = firstResult; final int max = max( first, queryHits.getTotalHits() ); final int size = max - first + 1; if ( size <= 0 ) {
QueryHits queryHits = getQueryHits( searcher, calculateTopDocsRetrievalSize() ); final int first = firstResult; final int max = max( first, queryHits.getTotalHits() ); final int size = max - first + 1; if ( size <= 0 ) {
@Override public int queryResultSize() { if ( resultSize == null ) { //the timeoutManager does not need to be stopped nor reset as a start does indeed reset getTimeoutManager().start(); //get result size without object initialization LazyQueryState searcher = buildSearcher( extendedIntegrator, false ); if ( searcher == null ) { resultSize = 0; } else { try { QueryHits queryHits = getQueryHits( searcher, 0, false ); resultSize = queryHits.getTotalHits(); } catch (IOException e) { throw new SearchException( "Unable to query Lucene index", e ); } finally { closeSearcher( searcher ); } } } return this.resultSize; }
@Override public int queryResultSize() { if ( resultSize == null ) { //the timeoutManager does not need to be stopped nor reset as a start does indeed reset getTimeoutManager().start(); //get result size without object initialization LazyQueryState searcher = buildSearcher( extendedIntegrator, false ); if ( searcher == null ) { resultSize = 0; } else { try { QueryHits queryHits = getQueryHits( searcher, 0 ); resultSize = queryHits.getTotalHits(); } catch (IOException e) { throw new SearchException( "Unable to query Lucene index", e ); } finally { closeSearcher( searcher ); } } } return this.resultSize; }
/** * DocumentExtractor returns a traverser over the full-text results (EntityInfo) * This operation is lazy bound: * - the query is executed * - results are not retrieved until actually requested * * DocumentExtractor objects *must* be closed when the results are no longer traversed. */ @Override public DocumentExtractor queryDocumentExtractor() { //keep the searcher open until the resultset is closed //find the directories LazyQueryState openSearcher = buildSearcher(); //FIXME: handle null searcher try { QueryHits queryHits = getQueryHits( openSearcher, calculateTopDocsRetrievalSize(), true ); int max = max( firstResult, queryHits.getTotalHits() ); return buildDocumentExtractor( openSearcher, queryHits, firstResult, max ); } catch (IOException e) { closeSearcher( openSearcher ); throw new SearchException( "Unable to query Lucene index", e ); } }
/** * DocumentExtractor returns a traverser over the full-text results (EntityInfo) * This operation is lazy bound: * - the query is executed * - results are not retrieved until actually requested * * DocumentExtractor objects *must* be closed when the results are no longer traversed. */ @Override public DocumentExtractor queryDocumentExtractor() { //keep the searcher open until the resultset is closed //find the directories LazyQueryState openSearcher = buildSearcher(); //FIXME: handle null searcher try { QueryHits queryHits = getQueryHits( openSearcher, calculateTopDocsRetrievalSize() ); int max = max( firstResult, queryHits.getTotalHits() ); return buildDocumentExtractor( openSearcher, queryHits, firstResult, max ); } catch (IOException e) { closeSearcher( openSearcher ); throw new SearchException( "Unable to query Lucene index", e ); } }
); resultSize = queryHits.getTotalHits();
); resultSize = queryHits.getTotalHits();