public class DocResults extends Results<DocResult> implements ResultGroups<Hit>
hitsObjId, NO_LIMIT, results, threadPauser
Modifier | Constructor and Description |
---|---|
protected |
DocResults(QueryInfo queryInfo)
Construct an empty DocResults.
|
protected |
DocResults(QueryInfo queryInfo,
Hits hits,
int maxHitsToStorePerDoc)
Construct per-document results objects from a Hits object
|
protected |
DocResults(QueryInfo queryInfo,
List<DocResult> results,
SampleParameters sampleParameters,
WindowStats windowStats)
Wraps a list of DocResult objects with the DocResults interface.
|
Modifier and Type | Method and Description |
---|---|
boolean |
docsProcessedAtLeast(int lowerBound)
Determines if there are at least a certain number of results
This may be used if we don't want to process all results (which may be a lot)
but we do need to know something about the size of the result set (such as
for paging).
|
int |
docsProcessedSoFar() |
protected int |
docsProcessedTotal()
Get the number of documents in this results set.
|
boolean |
doneProcessingAndCounting()
Check if we're done retrieving/counting hits.
|
static DocResults |
empty(QueryInfo queryInfo)
Construct an empty DocResults.
|
protected void |
ensureResultsRead(int index)
If we still have only partially read our Hits object, read some more of it
and add the hits.
|
DocResults |
filter(ResultProperty<DocResult> property,
PropertyValue value)
Select only the hits where the specified property has the specified value.
|
static DocResults |
fromHits(QueryInfo queryInfo,
Hits hits,
int maxHitsToStorePerDoc)
Construct a DocResults from a Hits instance.
|
static DocResults |
fromList(QueryInfo queryInfo,
List<DocResult> results,
SampleParameters sampleParameters,
WindowStats windowStats)
Construct a DocResults from a list of results.
|
static DocResults |
fromQuery(QueryInfo queryInfo,
org.apache.lucene.search.Query query)
Don't use this, use BlackLabIndex.queryDocuments().
|
Group<Hit> |
get(PropertyValue prop) |
Map<PropertyValue,? extends Group<Hit>> |
getGroupMap() |
DocGroups |
group(ResultProperty<DocResult> groupBy,
int maxResultsToStorePerGroup)
Group these hits by a criterium (or several criteria).
|
ResultProperty<Hit> |
groupCriteria()
What were these results grouped on?
|
int |
intSum(ResultProperty<DocResult> numProp)
Sum a property for all the documents.
|
int |
largestGroupSize()
Return the size of the largest group
|
int |
numberOfResultObjects()
How many result objects does this search store?
Used for estimating the cache size.
|
org.apache.lucene.search.Query |
query() |
DocResults |
sample(SampleParameters sampleParameters)
Take a sample of hits by wrapping an existing Hits object.
|
SampleParameters |
sampleParameters()
If this is a sample, return the sample parameters.
|
<P extends ResultProperty<DocResult>> |
sort(P sortProp)
Return a new Results object with these results sorted by the given property.
|
CorpusSize |
subcorpusSize()
Determine the size of the subcorpus defined by this set of documents.
|
CorpusSize |
subcorpusSize(boolean countTokens)
Determine the size of the subcorpus defined by this set of documents.
|
int |
sumOfGroupSizes()
Get the total number of results that were grouped
|
long |
tokensInMatchingDocs()
Deprecated.
use subcorpusSize().getTokens()
|
DocResults |
window(int first,
int number)
Get a window into the doc results
|
WindowStats |
windowStats()
If this is a hits window, return the window stats.
|
DocResults |
withFewerStoredResults(int maximumNumberOfResultsPerGroup)
Get an instance of this grouping with fewer stored results per group.
|
doFilter, doSample, doSort, doWindow, ensureAllResultsRead, field, get, index, isSample, isWindow, iterator, parallelStream, queryInfo, resultsCountedSoFar, resultsCountedTotal, resultsList, resultsObjId, resultsProcessedAtLeast, resultsProcessedSoFar, resultsProcessedTotal, resultsStats, resultsSubList, size, stream, threadPauser, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
field, get, index, queryInfo, size
forEach, spliterator
protected DocResults(QueryInfo queryInfo)
queryInfo
- protected DocResults(QueryInfo queryInfo, Hits hits, int maxHitsToStorePerDoc)
queryInfo
- query infohits
- the hits to view per-documentmaxHitsToStorePerDoc
- hits to store per documentprotected DocResults(QueryInfo queryInfo, List<DocResult> results, SampleParameters sampleParameters, WindowStats windowStats)
queryInfo
- query inforesults
- the list of resultswindowStats
- window statspublic static DocResults empty(QueryInfo queryInfo)
queryInfo
- query infopublic static DocResults fromList(QueryInfo queryInfo, List<DocResult> results, SampleParameters sampleParameters, WindowStats windowStats)
queryInfo
- query inforesults
- resultssampleParameters
- sample parameters (if this is a sample)windowStats
- window stats (if this is a window)public static DocResults fromHits(QueryInfo queryInfo, Hits hits, int maxHitsToStorePerDoc)
queryInfo
- query infohits
- hits to get document results frommaxHitsToStorePerDoc
- how many hits to store per document, for displaying snippets (-1 for all)public static DocResults fromQuery(QueryInfo queryInfo, org.apache.lucene.search.Query query)
queryInfo
- query infoquery
- query to executepublic WindowStats windowStats()
Results
windowStats
in class Results<DocResult>
public SampleParameters sampleParameters()
Results
sampleParameters
in class Results<DocResult>
public <P extends ResultProperty<DocResult>> DocResults sort(P sortProp)
Results
public boolean docsProcessedAtLeast(int lowerBound)
lowerBound
- the number we're testing againstpublic int docsProcessedSoFar()
protected int docsProcessedTotal()
protected void ensureResultsRead(int index)
ensureResultsRead
in class Results<DocResult>
index
- the number of results we want to ensure have been read, or
negative for all resultspublic DocGroups group(ResultProperty<DocResult> groupBy, int maxResultsToStorePerGroup)
Results
public DocResults window(int first, int number)
public int intSum(ResultProperty<DocResult> numProp)
numProp
- a numeric property to sumpublic int sumOfGroupSizes()
ResultGroups
sumOfGroupSizes
in interface ResultGroups<Hit>
public int largestGroupSize()
ResultGroups
largestGroupSize
in interface ResultGroups<Hit>
public Group<Hit> get(PropertyValue prop)
get
in interface ResultGroups<Hit>
public ResultProperty<Hit> groupCriteria()
ResultGroups
groupCriteria
in interface ResultGroups<Hit>
public DocResults filter(ResultProperty<DocResult> property, PropertyValue value)
Results
public DocResults withFewerStoredResults(int maximumNumberOfResultsPerGroup)
ResultGroups
withFewerStoredResults
in interface ResultGroups<Hit>
maximumNumberOfResultsPerGroup
- maximum number of results to store, or -1 for the samepublic DocResults sample(SampleParameters sampleParameters)
public boolean doneProcessingAndCounting()
Results
doneProcessingAndCounting
in class Results<DocResult>
public Map<PropertyValue,? extends Group<Hit>> getGroupMap()
getGroupMap
in interface ResultGroups<Hit>
public int numberOfResultObjects()
SearchResult
numberOfResultObjects
in interface SearchResult
@Deprecated public long tokensInMatchingDocs()
public CorpusSize subcorpusSize()
public CorpusSize subcorpusSize(boolean countTokens)
countTokens
- whether or not to count tokens (slower)public org.apache.lucene.search.Query query()
Copyright © 2020 Instituut voor Nederlandse Taal (INT). All rights reserved.