Constructor
new SearchTask(searchQuery)
Creates a `SearchTask` object used for searching any text string.
Parameters:
Name | Type | Description |
---|---|---|
searchQuery |
string | IPCC.ViewerControl~SearchQuery | A value specifying the search query. The value specifies a single search term (string) or an object specifying multiple search terms and options. _NOTE: The searchQuery can be a single search term or a hash specifying one or more terms and options. If only a single search term (string) is supplied, then default options are used._ |
Throws:
-
-
If search query is not a string or a valid IPCC.ViewerControl~SearchQuery object.
- Type
- Error
-
-
-
When using the `SearchQuery` object, if the `searchQuery.searchTerm` is not an Array.
- Type
- Error
-
-
-
When using the `SearchQuery` object, if the `searchQuery.searchTerms[i].searchTerm` property of each Object in ther `searchTerms` array is not a string.
- Type
- Error
-
-
-
If the combination of a search terms and matching options results in an invalid search, such as performing a wildcard search with only a `*` character and no valid content.
- Type
- Error
-
Example
// Search on multiple terms and specify options
var searchQuery = {
searchTerms: [{
searchTerm: "Full",
contextPadding: 10,
highlightColor: '#B22222',
matchingOptions: {
beginsWith: true,
}
}]
};
// create a text annotation
var mark1 = viewerControl.addMark(1, "TextAnnotation");
set text in the text annotation
mark1.setText("When Full-Text Search is being installed for an existing client without Full-Text Search");
// create IPCC.SearchTask object
var searchTask = new IPCC.SearchTask(searchQuery);
// use the method IPCC.SearchTask.search to search the word "Full" in mark1 annotation text.
var results = searchTask.search(mark1.mark1.getText());
//use it search some other text string
var results2 = searchTask.search("To enable the full-text search functionality, your system should have a dedicated server.");
Methods
search(The) → {Array.<IPCC.SearchTaskResult>}
Searches any text string using the search criteria that were provided to the IPCC.SearchTask constructor.
Parameters:
Name | Type | Description |
---|---|---|
The |
string | text string to be searched. |
Returns:
An array of IPCC.SearchTaskResult objects.
- Type
- Array.<IPCC.SearchTaskResult>
Example
var searchQuery = {
searchTerms: [{
searchTerm: "client",
contextPadding: 10,
highlightColor: '#B22222',
matchingOptions: {
beginsWith: true,
}
}]
};
var textString = "When Full-Text Search is being installed for an existing client without Full-Text Search";
var searchTask = new IPCC.SearchTask(searchQuery);
//search the textString
var results = searchTask.search(textString);