[英]Returns how many hits matched the search. [中]返回与搜索匹配的点击数。
代码示例
代码示例来源:origin: org.apache.lucene/lucene-core
@Override public Integer reduce(Collection collectors) throws IOException { int total = 0; for (TotalHitCountCollector collector : collectors) { total += collector.getTotalHits(); } return total; }
代码示例来源:origin: neo4j/neo4j
@Override public long countIndexedNodes( long nodeId, int[] propertyKeyIds, Value... propertyValues ) { try { String[] propertyKeys = new String[propertyKeyIds.length]; for ( int i = 0; i { propertyKeys[i] = propertyKeyTokenHolder.getTokenById( propertyKeyIds[i] ).name(); } Query query = LuceneFulltextDocumentStructure.newCountNodeEntriesQuery( nodeId, propertyKeys, propertyValues ); TotalHitCountCollector collector = new TotalHitCountCollector(); getIndexSearcher().search( query, collector ); return collector.getTotalHits(); } catch ( Exception e ) { throw new RuntimeException( e ); } } }
代码示例来源:origin: neo4j/neo4j
@Override public long countIndexedNodes( long nodeId, int[] propertyKeyIds, Value... propertyValues ) { Query nodeIdQuery = new TermQuery( LuceneDocumentStructure.newTermForChangeOrRemove( nodeId ) ); Query valueQuery = LuceneDocumentStructure.newSeekQuery( propertyValues ); BooleanQuery.Builder nodeIdAndValueQuery = new BooleanQuery.Builder().setDisableCoord( true ); nodeIdAndValueQuery.add( nodeIdQuery, BooleanClause.Occur.MUST ); nodeIdAndValueQuery.add( valueQuery, BooleanClause.Occur.MUST ); try { TotalHitCountCollector collector = new TotalHitCountCollector(); getIndexSearcher().search( nodeIdAndValueQuery.build(), collector ); // A
代码示例来源:origin: querydsl/querydsl
private long innerCount() { try { final int maxDoc = searcher.maxDoc(); if (maxDoc == 0) { return 0; } TotalHitCountCollector collector = new TotalHitCountCollector(); searcher.search(createQuery(), getFilter(), collector); return collector.getTotalHits(); } catch (IOException e) { throw new QueryException(e); } catch (IllegalArgumentException e) { throw new QueryException(e); } }
代码示例来源:origin: querydsl/querydsl
private long innerCount() { try { final int maxDoc = searcher.getIndexReader().maxDoc(); if (maxDoc == 0) { return 0; } TotalHitCountCollector collector = new TotalHitCountCollector(); searcher.search(createQuery(), getFilter(), collector); return collector.getTotalHits(); } catch (IOException e) { throw new QueryException(e); } catch (IllegalArgumentException e) { throw new QueryException(e); } }
代码示例来源:origin: querydsl/querydsl
private long innerCount() { try { final int maxDoc = searcher.getIndexReader().maxDoc(); if (maxDoc == 0) { return 0; } TotalHitCountCollector collector = new TotalHitCountCollector(); searcher.search(createQuery(), getFilter(), collector); return collector.getTotalHits(); } catch (IOException e) { throw new QueryException(e); } catch (IllegalArgumentException e) { throw new QueryException(e); } }
@Override public Integer reduce(Collection collectors) throws IOException { int total = 0; for (TotalHitCountCollector collector : collectors) { total += collector.getTotalHits(); } return total; }
@Override public Integer reduce(Collection collectors) throws IOException { int total = 0; for (TotalHitCountCollector collector : collectors) { total += collector.getTotalHits(); } return total; }
代码示例来源:origin: harbby/presto-connectors
@Override public Integer reduce(Collection collectors) throws IOException { int total = 0; for (TotalHitCountCollector collector : collectors) { total += collector.getTotalHits(); } return total; }
代码示例来源:origin: hibernate/hibernate-search
public long getTotalHits() { return totalHitCountCollector.getTotalHits(); }
private int searchHits( final Query query, final ClusterSegment... clusterSegments ) { final IndexSearcher index = indexManager.getIndexSearcher( clusterSegments ); try { final TotalHitCountCollector collector = new TotalHitCountCollector(); index.search( query, collector ); return collector.getTotalHits(); } catch ( final Exception ex ) { throw new RuntimeException( "Error during Query!", ex ); } finally { indexManager.release( index ); } }
代码示例来源:origin: org.elasticsearch/elasticsearch
TotalHitCountCollector totalHitCountCollector = new TotalHitCountCollector(); intersect(weight, innerHitQueryWeight, totalHitCountCollector, ctx); result[i] = new TopDocs(totalHitCountCollector.getTotalHits(), Lucene.EMPTY_SCORE_DOCS, 0); } else { int topN = Math.min(from() + size(), context.searcher().getIndexReader().maxDoc());