private Document extractDocument(int index) throws IOException { if ( allowFieldSelection ) { if ( fieldLoadingVisitor == null ) { //we need no fields return null; } else { queryHits.visitDocument( index, fieldLoadingVisitor ); return fieldLoadingVisitor.getDocumentAndReset(); } } else { return queryHits.doc( index ); } }
/** * This document loading strategy doesn't return anything as it's the responsibility * of the passed StoredFieldVisitor instance to collect the data it needs. * * @param index {@link ScoreDoc} index * @param fieldVisitor accessor to the stored field value in the index * * @throws IOException if an error occurs accessing the index */ public void visitDocument(int index, StoredFieldVisitor fieldVisitor) throws IOException { searcher.doc( docId( index ), fieldVisitor ); }
Collector collector; if ( maxDocs != 0 ) { topDocCollector = createTopDocCollector( maxDocs ); hitCountCollector = null; collector = topDocCollector; collector = optionallyEnableFacetingCollector( collector ); collector = optionallyEnableDistanceCollector( collector, maxDocs ); collector = hitCountCollector; collector = decorateWithTimeOutCollector( collector ); boolean timeoutNow = isImmediateTimeout(); if ( !timeoutNow ) { try { updateFacets();
@Override public EntityInfo extract(int scoreDocIndex) throws IOException { int docId = queryHits.docId( scoreDocIndex ); Document document = extractDocument( scoreDocIndex ); for ( int x = 0; x < projection.length; x++ ) { if ( ProjectionConstants.SCORE.equals( projection[x] ) ) { projected[x] = queryHits.score( scoreDocIndex ); projected[x] = queryHits.explain( scoreDocIndex ); projected[x] = queryHits.spatialDistance( scoreDocIndex );
queryHits = new QueryHits( searcher, filters, queryHits = new QueryHits( searcher, filters, queryHits = new QueryHits( searcher, filters, ); resultSize = queryHits.getTotalHits(); .searchExecuted( searcher.describeQuery(), System.nanoTime() - startTime ); getFacetManager().setFacetResults( queryHits.getFacets() ); return queryHits;
private ArrayList<Facet> updateRangeFacets(RangeFacetRequest<?> facetRequest, FacetMetadata facetMetadata) throws IOException { ArrayList<Facet> facets; if ( ReflectionHelper.isIntegerType( facetRequest.getFacetValueType() ) || Date.class.isAssignableFrom( facetRequest.getFacetValueType() ) ) { FacetResult facetResult = getFacetResultForLongRange( facetRequest ); facets = new ArrayList<>( facetResult.labelValues.length ); for ( LabelAndValue labelAndValue : facetResult.labelValues ) { if ( !facetRequest.hasZeroCountsIncluded() && (int) labelAndValue.value == 0 ) { continue; } Facet facet = facetRequest.createFacet( facetMetadata, labelAndValue.label, (int) labelAndValue.value ); facets.add( facet ); } } else if ( ReflectionHelper.isFloatingPointType( facetRequest.getFacetValueType() ) ) { FacetResult facetResult = getFacetResultForFloatingPointRange( facetRequest ); facets = new ArrayList<>( facetResult.labelValues.length ); for ( LabelAndValue labelAndValue : facetResult.labelValues ) { if ( !facetRequest.hasZeroCountsIncluded() && (int) labelAndValue.value == 0 ) { continue; } Facet facet = facetRequest.createFacet( facetMetadata, labelAndValue.label, (int) labelAndValue.value ); facets.add( facet ); } } else { throw log.unsupportedFacetRangeParameter( facetRequest.getFacetValueType().getName() ); } return facets; }
); QueryHits queryHits = new QueryHits( lowLevelSearcher, QueryFilters.EMPTY_FILTERSET, null, true, new TimeoutManagerImpl( luceneQuery, QueryTimeoutException.DEFAULT_TIMEOUT_EXCEPTION_FACTORY, extendedIntegrator.getTimingSource() ),
termValues = findAllTermsForField( facetMetadata.getSourceField().getAbsoluteName(), searcher.getIndexReader() );
topDocCollector = createTopDocCollector( maxDocs ); hitCountCollector = null; collector = topDocCollector; collector = optionallyEnableFacetingCollector( collector ); collector = optionallyEnableDistanceCollector( collector, maxDocs ); collector = hitCountCollector; collector = decorateWithTimeOutCollector( collector ); boolean timeoutNow = isImmediateTimeout(); if ( !timeoutNow ) { try { updateFacets();
@Override public EntityInfo extract(int scoreDocIndex) throws IOException { int docId = queryHits.docId( scoreDocIndex ); Document document = extractDocument( scoreDocIndex ); for ( int x = 0; x < projection.length; x++ ) { if ( ProjectionConstants.SCORE.equals( projection[x] ) ) { projected[x] = queryHits.score( scoreDocIndex ); projected[x] = queryHits.explain( scoreDocIndex ); projected[x] = queryHits.spatialDistance( scoreDocIndex );
queryHits = new QueryHits( searcher, filters, queryHits = new QueryHits( searcher, filters, queryHits = new QueryHits( searcher, filters, ); resultSize = queryHits.getTotalHits(); .searchExecuted( searcher.describeQuery(), System.nanoTime() - startTime ); getFacetManager().setFacetResults( queryHits.getFacets() ); return queryHits;
private ArrayList<Facet> updateRangeFacets(RangeFacetRequest<?> facetRequest, FacetMetadata facetMetadata) throws IOException { ArrayList<Facet> facets; if ( ReflectionHelper.isIntegerType( facetRequest.getFacetValueType() ) || Date.class.isAssignableFrom( facetRequest.getFacetValueType() ) ) { FacetResult facetResult = getFacetResultForLongRange( facetRequest ); facets = new ArrayList<>( facetResult.labelValues.length ); for ( LabelAndValue labelAndValue : facetResult.labelValues ) { if ( !facetRequest.hasZeroCountsIncluded() && (int) labelAndValue.value == 0 ) { continue; } Facet facet = facetRequest.createFacet( facetMetadata, labelAndValue.label, (int) labelAndValue.value ); facets.add( facet ); } } else if ( ReflectionHelper.isFloatingPointType( facetRequest.getFacetValueType() ) ) { FacetResult facetResult = getFacetResultForFloatingPointRange( facetRequest ); facets = new ArrayList<>( facetResult.labelValues.length ); for ( LabelAndValue labelAndValue : facetResult.labelValues ) { if ( !facetRequest.hasZeroCountsIncluded() && (int) labelAndValue.value == 0 ) { continue; } Facet facet = facetRequest.createFacet( facetMetadata, labelAndValue.label, (int) labelAndValue.value ); facets.add( facet ); } } else { throw log.unsupportedFacetRangeParameter( facetRequest.getFacetValueType().getName() ); } return facets; }
termValues = findAllTermsForField( facetMetadata.getSourceField().getAbsoluteName(), searcher.getIndexReader() );
public Double spatialDistance(int index) throws IOException { if ( spatialSearchCenter == null ) { return null; } return distanceCollector.getDistance( docId( index ) ); }
private Document extractDocument(int index) throws IOException { if ( allowFieldSelection ) { if ( fieldLoadingVisitor == null ) { //we need no fields return null; } else { queryHits.visitDocument( index, fieldLoadingVisitor ); return fieldLoadingVisitor.getDocumentAndReset(); } } else { return queryHits.doc( index ); } }
public Double spatialDistance(int index) throws IOException { if ( spatialSearchCenter == null ) { return null; } return distanceCollector.getDistance( docId( index ) ); }
/** * This document loading strategy doesn't return anything as it's the responsibility * of the passed StoredFieldVisitor instance to collect the data it needs. * * @param index {@link ScoreDoc} index * @param fieldVisitor accessor to the stored field value in the index * * @throws IOException if an error occurs accessing the index */ public void visitDocument(int index, StoredFieldVisitor fieldVisitor) throws IOException { searcher.doc( docId( index ), fieldVisitor ); }
public Document doc(int index) throws IOException { return searcher.doc( docId( index ) ); }
public Document doc(int index) throws IOException { return searcher.doc( docId( index ) ); }
public Explanation explain(int index) throws IOException { final Explanation explanation = searcher.explain( filters, docId( index ) ); timeoutManager.isTimedOut(); return explanation; }