T
- result type, e.g. Hitpublic abstract class Results<T> extends Object implements SearchResult, Iterable<T>
Modifier and Type | Field and Description |
---|---|
protected int |
hitsObjId
Unique id of this Hits instance (for debugging)
|
static int |
NO_LIMIT
When setting how many hits to retrieve/count/store in group, this means "no limit".
|
protected List<T> |
results
The results.
|
protected ThreadPauser |
threadPauser
Helper object for pausing threads (making sure queries
don't hog the CPU for way too long).
|
Modifier and Type | Method and Description |
---|---|
protected static <T> List<T> |
doFilter(Results<T> results,
ResultProperty<T> property,
PropertyValue value) |
abstract boolean |
doneProcessingAndCounting()
Check if we're done retrieving/counting hits.
|
protected static <T> List<T> |
doSample(Results<T> source,
SampleParameters sampleParameters) |
protected static <P extends ResultProperty<T>,T> |
doSort(Results<T> results,
P sortProp) |
protected static <T> List<T> |
doWindow(Results<T> results,
int first,
int number) |
protected void |
ensureAllResultsRead()
Ensure that we have read all results.
|
protected abstract void |
ensureResultsRead(int number)
Ensure that we have read at least as many results as specified in the parameter.
|
AnnotatedField |
field()
Get the field these hits are from.
|
abstract Results<T> |
filter(ResultProperty<T> property,
PropertyValue value)
Select only the hits where the specified property has the specified value.
|
T |
get(int i)
Return the specified hit.
|
abstract ResultGroups<T> |
group(ResultProperty<T> criteria,
int maxResultsToStorePerGroup)
Group these hits by a criterium (or several criteria).
|
BlackLabIndex |
index()
Get the index these hits are from.
|
boolean |
isSample()
Is this sampled from another instance?
|
boolean |
isWindow()
Is this a hits window?
|
Iterator<T> |
iterator()
Return an iterator over these hits.
|
Stream<T> |
parallelStream()
Return a parallel stream of these hits.
|
QueryInfo |
queryInfo()
Get information about the original query.
|
protected int |
resultsCountedSoFar() |
protected int |
resultsCountedTotal() |
protected List<T> |
resultsList()
Get the list of results.
|
int |
resultsObjId() |
protected boolean |
resultsProcessedAtLeast(int lowerBound) |
protected int |
resultsProcessedSoFar() |
protected int |
resultsProcessedTotal() |
ResultsStats |
resultsStats() |
protected List<T> |
resultsSubList(int fromIndex,
int toIndex)
Get part of the list of results.
|
abstract Results<T> |
sample(SampleParameters sampleParameters)
Take a sample of results.
|
SampleParameters |
sampleParameters()
If this is a sample, return the sample parameters.
|
int |
size()
This is an alias of resultsProcessedTotal().
|
abstract <P extends ResultProperty<T>> |
sort(P sortProp)
Return a new Results object with these results sorted by the given property.
|
Stream<T> |
stream()
Return a stream of these hits.
|
ThreadPauser |
threadPauser() |
String |
toString() |
abstract Results<T> |
window(int first,
int windowSize)
Get a window into this list of results.
|
WindowStats |
windowStats()
If this is a hits window, return the window stats.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
numberOfResultObjects
forEach, spliterator
public static final int NO_LIMIT
protected final int hitsObjId
protected ThreadPauser threadPauser
public Results(QueryInfo queryInfo)
protected static <T> List<T> doSample(Results<T> source, SampleParameters sampleParameters)
protected static <T> List<T> doFilter(Results<T> results, ResultProperty<T> property, PropertyValue value)
protected static <P extends ResultProperty<T>,T> List<T> doSort(Results<T> results, P sortProp)
public QueryInfo queryInfo()
public AnnotatedField field()
public BlackLabIndex index()
public int resultsObjId()
public ThreadPauser threadPauser()
public boolean isWindow()
public WindowStats windowStats()
public boolean isSample()
public SampleParameters sampleParameters()
public Stream<T> parallelStream()
public T get(int i)
i
- index of the desired hitpublic abstract ResultGroups<T> group(ResultProperty<T> criteria, int maxResultsToStorePerGroup)
criteria
- the hit property to group onmaxResultsToStorePerGroup
- maximum number of results to store per group, or -1 for allpublic abstract Results<T> filter(ResultProperty<T> property, PropertyValue value)
property
- property to select on, e.g. "word left of hit"value
- value to select on, e.g. 'the'public abstract <P extends ResultProperty<T>> Results<T> sort(P sortProp)
sortProp
- the property to sort onpublic abstract Results<T> sample(SampleParameters sampleParameters)
sampleParameters
- sample parameterspublic abstract Results<T> window(int first, int windowSize)
first
- first result in the window (0-based)windowSize
- desired size of the window (if there's enough results)protected abstract void ensureResultsRead(int number)
number
- the minimum number of results that will have been read when this
method returns (unless there are fewer hits than this); if
negative, reads all hitsprotected void ensureAllResultsRead()
public ResultsStats resultsStats()
protected boolean resultsProcessedAtLeast(int lowerBound)
public int size()
protected int resultsProcessedTotal()
protected int resultsProcessedSoFar()
protected int resultsCountedSoFar()
protected int resultsCountedTotal()
protected List<T> resultsSubList(int fromIndex, int toIndex)
protected List<T> resultsList()
public abstract boolean doneProcessingAndCounting()
Copyright © 2020 Instituut voor Nederlandse Taal (INT). All rights reserved.