Package nzilbb.labbcat.server.search
Class SearchTask
- java.lang.Object
-
- java.lang.Thread
-
- nzilbb.labbcat.server.task.Task
-
- nzilbb.labbcat.server.search.SearchTask
-
- All Implemented Interfaces:
Runnable
,nzilbb.util.MonitorableTask
- Direct Known Subclasses:
AllUtterancesTask
,OneQuerySearch
public abstract class SearchTask extends Task
Base class for search implementations, which return a set of search results.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description SearchTask()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Byte
getAnchorConfidenceThreshold()
Getter foranchorConfidenceThreshold
: If non-null, then only targets whose anchors have an alignment status greater than or equals to this value will be returned.String
getDescription()
Getter fordescription
: A short, more or less human readable description of the search.boolean
getMainParticipantOnly()
Getter formainParticipantOnly
: Whether to seearch main-participant utterances only or not.Integer
getMatchesPerTranscript()
Getter formatchesPerTranscript
: Maximum number of matches per transcript to return, or null for all matches.Matrix
getMatrix()
Getter formatrix
: Matrix that defines this search.int
getMaxMatches()
Getter formaxMatches
: Maximum total number of matches to return.Integer
getOverlapThreshold()
Getter foroverlapThreshold
: Percentage overlap with other utterances before simultaeous speech is excluded, or null to include all simultaneous speech.String
getRestrictByUser()
Getter forrestrictByUser
: The user ID to use to restrict access to search results, if any (e.g.SearchResults
getResults()
Getter forresults
: The results of the search.boolean
getSuppressResults()
Getter forsuppressResults
: Whether to suppress the results list (i.e.Integer
getWordsContext()
Getter forwordsContext
: Number of words context to specify for the matches page, or null to not specify the 'wordsContext' URL parameter.void
run()
Implementors should not override this - it callssearch()
but also performs various housekeeping operations.SearchTask
setAnchorConfidenceThreshold(Byte newAnchorConfidenceThreshold)
Setter foranchorConfidenceThreshold
: If non-null, then only targets whose anchors have an alignment status greater than or equals to this value will be returned.SearchTask
setDescription(String newDescription)
Setter fordescription
: A short, more or less human readable description of the search.SearchTask
setMainParticipantOnly(boolean newMainParticipantOnly)
Setter formainParticipantOnly
: Whether to seearch main-participant utterances only or not.SearchTask
setMatchesPerTranscript(Integer newMatchesPerTranscript)
Setter formatchesPerTranscript
: Maximum number of matches per transcript to return, or null for all matches.SearchTask
setMatrix(Matrix newMatrix)
Setter formatrix
: Matrix that defines this search.SearchTask
setMaxMatches(int newMaxMatches)
Setter formaxMatches
: Maximum total number of matches to return.SearchTask
setOverlapThreshold(Integer newOverlapThreshold)
Setter foroverlapThreshold
: Percentage overlap with other utterances before simultaeous speech is excluded, or null to include all simultaneous speech.SearchTask
setRestrictByUser(String newRestrictByUser)
Setter forrestrictByUser
: The user ID to use to restrict access to search results, if any (e.g.SearchTask
setResults(SearchResults newResults)
Setter forresults
: The results of the search.SearchTask
setSuppressResults(boolean newSuppressResults)
Setter forsuppressResults
: Whether to suppress the results list (i.e.SearchTask
setWordsContext(Integer newWordsContext)
Setter forwordsContext
: Number of words context to specify for the matches page, or null to not specify the 'wordsContext' URL parameter.String
validate()
Validates the search conditions.-
Methods inherited from class nzilbb.labbcat.server.task.Task
cancel, defaultThreadName, findTask, findTask, getCreationTime, getDuration, getLastException, getLastKeepAlive, getLog, getMaxLogSize, getPercentComplete, getResources, getResultTarget, getResultText, getResultUrl, getRunning, getStatus, getStore, getStoreCache, getTaskThreadGroup, getWaitToDieMilliseconds, getWho, keepAlive, release, setLastException, setLastKeepAlive, setMaxLogSize, setResources, setResultTarget, setResultText, setResultUrl, setStatus, setStore, setStoreCache, setWaitToDieMilliseconds, setWho, waitToDie, waitToDie
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Method Detail
-
getMatrix
public Matrix getMatrix()
Getter formatrix
: Matrix that defines this search.- Returns:
- Matrix that defines this search.
-
setMatrix
public SearchTask setMatrix(Matrix newMatrix)
Setter formatrix
: Matrix that defines this search.- Parameters:
newMatrix
- Matrix that defines this search.
-
getMainParticipantOnly
public boolean getMainParticipantOnly()
Getter formainParticipantOnly
: Whether to seearch main-participant utterances only or not.- Returns:
- Whether to seearch main-participant utterances only or not.
-
setMainParticipantOnly
public SearchTask setMainParticipantOnly(boolean newMainParticipantOnly)
Setter formainParticipantOnly
: Whether to seearch main-participant utterances only or not.- Parameters:
newMainParticipantOnly
- Whether to seearch main-participant utterances only or not.
-
getSuppressResults
public boolean getSuppressResults()
Getter forsuppressResults
: Whether to suppress the results list (i.e. show only a summary of results)- Returns:
- Whether to suppress the results list (i.e. show only a summary of results)
-
setSuppressResults
public SearchTask setSuppressResults(boolean newSuppressResults)
Setter forsuppressResults
: Whether to suppress the results list (i.e. show only a summary of results)- Parameters:
newSuppressResults
- Whether to suppress the results list (i.e. show only a summary of results)
-
getMatchesPerTranscript
public Integer getMatchesPerTranscript()
Getter formatchesPerTranscript
: Maximum number of matches per transcript to return, or null for all matches.- Returns:
- Maximum number of matches per transcript to return, or null for all matches.
-
setMatchesPerTranscript
public SearchTask setMatchesPerTranscript(Integer newMatchesPerTranscript)
Setter formatchesPerTranscript
: Maximum number of matches per transcript to return, or null for all matches.- Parameters:
newMatchesPerTranscript
- Maximum number of matches per transcript to return, or null for all matches.
-
getMaxMatches
public int getMaxMatches()
Getter formaxMatches
: Maximum total number of matches to return.- Returns:
- Maximum total number of matches to return, 0 meaning 'no limit'.
-
setMaxMatches
public SearchTask setMaxMatches(int newMaxMatches)
Setter formaxMatches
: Maximum total number of matches to return.- Parameters:
newMaxMatches
- Maximum total number of matches to return, 0 meaning 'no limit'.
-
getOverlapThreshold
public Integer getOverlapThreshold()
Getter foroverlapThreshold
: Percentage overlap with other utterances before simultaeous speech is excluded, or null to include all simultaneous speech.- Returns:
- Percentage overlap with other utterances before simultaeous speech is excluded, or null to include all simultaneous speech.
-
setOverlapThreshold
public SearchTask setOverlapThreshold(Integer newOverlapThreshold)
Setter foroverlapThreshold
: Percentage overlap with other utterances before simultaeous speech is excluded, or null to include all simultaneous speech.- Parameters:
newOverlapThreshold
- Percentage overlap with other utterances before simultaeous speech is excluded, or null to include all simultaneous speech.
-
getAnchorConfidenceThreshold
public Byte getAnchorConfidenceThreshold()
Getter foranchorConfidenceThreshold
: If non-null, then only targets whose anchors have an alignment status greater than or equals to this value will be returned.- Returns:
- If non-null, then only targets whose anchors have an alignment status greate than or equals to this value will be returned.
-
setAnchorConfidenceThreshold
public SearchTask setAnchorConfidenceThreshold(Byte newAnchorConfidenceThreshold)
Setter foranchorConfidenceThreshold
: If non-null, then only targets whose anchors have an alignment status greater than or equals to this value will be returned.- Parameters:
newAnchorConfidenceThreshold
- If non-null, then only targets whose anchors have an alignment status greater than or equals to this value will be returned.
-
getRestrictByUser
public String getRestrictByUser()
Getter forrestrictByUser
: The user ID to use to restrict access to search results, if any (e.g. admin users should not have this set).- Returns:
- The user ID to use to restrict access to search results, if any (e.g. admin users should not have this set).
-
setRestrictByUser
public SearchTask setRestrictByUser(String newRestrictByUser)
Setter forrestrictByUser
: The user ID to use to restrict access to search results, if any (e.g. admin users should not have this set).- Parameters:
newRestrictByUser
- The user ID to use to restrict access to search results, if any (e.g. admin users should not have this set).
-
getDescription
public String getDescription()
Getter fordescription
: A short, more or less human readable description of the search.- Returns:
- A short, more or less human readable description of the search.
-
setDescription
public SearchTask setDescription(String newDescription)
Setter fordescription
: A short, more or less human readable description of the search.- Parameters:
newDescription
- A short, more or less human readable description of the search.
-
getResults
public SearchResults getResults()
Getter forresults
: The results of the search.- Returns:
- The results of the search.
-
setResults
public SearchTask setResults(SearchResults newResults)
Setter forresults
: The results of the search.- Parameters:
newResults
- The results of the search.
-
getWordsContext
public Integer getWordsContext()
Getter forwordsContext
: Number of words context to specify for the matches page, or null to not specify the 'wordsContext' URL parameter.- Returns:
- Number of words context to specify for the matches page, or null to not specify the 'wordsContext' URL parameter.
-
setWordsContext
public SearchTask setWordsContext(Integer newWordsContext)
Setter forwordsContext
: Number of words context to specify for the matches page, or null to not specify the 'wordsContext' URL parameter.- Parameters:
newWordsContext
- Number of words context to specify for the matches page, or null to not specify the 'wordsContext' URL parameter.
-
validate
public String validate()
Validates the search conditions.- Returns:
- A message describing a validation error, or null if the conditions are valid
-
-