new SearchTaskResult()
The SearchTaskResult
object is created when searching a given text. It represents a "search hit", the text in the provided text that matched a search term in the searchQuery
, which was passed to the method PCCViewer.SearchTask.search.
This constructor should not be used directly. Instead, only access search results created by the method PCCViewer.SearchTask.search method.
Members
(readonly) context :string
Gets the search result text and some surrounding text.
The number of character in the context before and after the search result text can be configured using the PCCViewer.ViewerControl~SearchQuery passed to the PCCViewer.SearchTask constructor.
This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8.
Type:
- string
(readonly) context :string
Gets the search result text and some surrounding text.
The number of character in the context before and after the search result text can be configured using the PCCViewer.ViewerControl~SearchQuery passed to the PCCViewer.SearchTask constructor.
This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8.
Type:
- string
(readonly) highlightColor :string
Gets the highlight color of the search result, in hex notation (e.g. "#F1F1F1").
The highlight color can be specified in the PCCViewer.ViewerControl~SearchQuery passed to the PCCViewer.SearchTask constructor. If a highlight color is not specified on the searchQuery
, then a pseudo-random color is chosen.
This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8.
Type:
- string
(readonly) highlightColor :string
Gets the highlight color of the search result, in hex notation (e.g. "#F1F1F1").
The highlight color can be specified in the PCCViewer.ViewerControl~SearchQuery passed to the PCCViewer.SearchTask constructor. If a highlight color is not specified on the searchQuery
, then a pseudo-random color is chosen.
This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8.
Type:
- string
(readonly) id :number
Gets the ID of the search result.
The ID is unique only to results in the current search request, and it may be repeated in later search requests.
This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8.
Type:
- number
(readonly) id :number
Gets the ID of the search result.
The ID is unique only to results in the current search request, and it may be repeated in later search requests.
This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8.
Type:
- number
(readonly) text :string
Gets the search result text. This is the text that matched the search query/term.
This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8.
Type:
- string
(readonly) text :string
Gets the search result text. This is the text that matched the search query/term.
This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8.
Type:
- string
Methods
getContext() → {string}
Gets the search result text and some surrounding text.
The number of character in the context before and after the search result text can be configured using the PCCViewer.ViewerControl~SearchQuery passed to the PCCViewer.SearchTask#search method.
- See:
-
- Use PCCViewer.SearchTaskResult#getStartIndexInContext to identify the location of the search result text within the context.
Returns:
The context of the search result.
- Type
- string
Example
var mark1 = viewerControl.addMark(1, "TextAnnotation");
mark1.setText("When Full-Text Search is being installed for an existing client without Full-Text Search");
var searchTask = new PCCViewer.SearchTask(searchQuery);
var results = searchTask.search(mark1.getText());
var result = results[0];
result.getText(); // e.g. "document"
result.getContext(); // e.g. "... the full spectrum of document, content, & imaging s..."
result.getStartIndexInContext(); // e.g. 25
getContext() → {string}
Gets the search result text and some surrounding text.
The number of character in the context before and after the search result text can be configured using the PCCViewer.ViewerControl~SearchQuery passed to the PCCViewer.SearchTask#search method.
- See:
-
- Use PCCViewer.SearchTaskResult#getStartIndexInContext to identify the location of the search result text within the context.
Returns:
The context of the search result.
- Type
- string
Example
var mark1 = viewerControl.addMark(1, "TextAnnotation");
mark1.setText("When Full-Text Search is being installed for an existing client without Full-Text Search");
var searchTask = new PCCViewer.SearchTask(searchQuery);
var results = searchTask.search(mark1.getText());
var result = results[0];
result.getText(); // e.g. "document"
result.getContext(); // e.g. "... the full spectrum of document, content, & imaging s..."
result.getStartIndexInContext(); // e.g. 25
getHighlightColor() → {string}
Gets the highlight color of the search result, in hex notation (e.g. "#F1F1F1").
The highlight color can be specified in the PCCViewer.ViewerControl~SearchQuery passed to the PCCViewer.ViewerControl#search method. If a highlight color is not specified on the searchQuery
, then a pseudo-random color is chosen.
Returns:
The color of the search result highlight, in hexadecimal notation.
- Type
- string
Example
var mark1 = viewerControl.addMark(1, "TextAnnotation");
mark1.setText("When Full-Text Search is being installed for an existing client without Full-Text Search");
var searchTask = new PCCViewer.SearchTask(searchQuery);
var results = searchTask.search(mark1.getText());
var result = results[0];
var highlightColor = result.getHighlightColor();
getHighlightColor() → {string}
Gets the highlight color of the search result, in hex notation (e.g. "#F1F1F1").
The highlight color can be specified in the PCCViewer.ViewerControl~SearchQuery passed to the PCCViewer.ViewerControl#search method. If a highlight color is not specified on the searchQuery
, then a pseudo-random color is chosen.
Returns:
The color of the search result highlight, in hexadecimal notation.
- Type
- string
Example
var mark1 = viewerControl.addMark(1, "TextAnnotation");
mark1.setText("When Full-Text Search is being installed for an existing client without Full-Text Search");
var searchTask = new PCCViewer.SearchTask(searchQuery);
var results = searchTask.search(mark1.getText());
var result = results[0];
var highlightColor = result.getHighlightColor();
getId() → {number}
Gets the ID of the search result.
The ID is unique only to results in the current search request, and it may be repeated in later search requests.
Returns:
The ID of the search result.
- Type
- number
Example
var mark1 = viewerControl.addMark(1, "TextAnnotation");
mark1.setText("When Full-Text Search is being installed for an existing client without Full-Text Search");
var searchTask = new PCCViewer.SearchTask(searchQuery);
var results = searchTask.search(mark1.getText());
var result = results[0];
var id = result.getId();
getId() → {number}
Gets the ID of the search result.
The ID is unique only to results in the current search request, and it may be repeated in later search requests.
Returns:
The ID of the search result.
- Type
- number
Example
var mark1 = viewerControl.addMark(1, "TextAnnotation");
mark1.setText("When Full-Text Search is being installed for an existing client without Full-Text Search");
var searchTask = new PCCViewer.SearchTask(searchQuery);
var results = searchTask.search(mark1.getText());
var result = results[0];
var id = result.getId();
getSearchTerm() → {PCCViewer.ViewerControl~SearchTerm|PCCViewer.ViewerControl~ProximitySearchTerm}
Gets the search term object from the searchQuery
object that was passed to the PCCViewer.SearchTask constructor.
If a string was passed to the PCCViewer.SearchTask constructor, then this will return a PCCViewer.ViewerControl~SearchTerm object generated from the string.
The returned object will be augmented with all options used for searching.
Returns:
The search term of the search result.
Example
var mark1 = viewerControl.addMark(1, "TextAnnotation");
mark1.setText("When Full-Text Search is being installed for an existing client without Full-Text Search");
var searchTask = new PCCViewer.SearchTask(searchQuery);
var results = searchTask.search(mark1.getText());
var result = results[0];
var searchTerm = result.getSearchTerm();
alert("This search result matched the search term: " + searchTerm.searchTerm);
getSearchTerm() → {PCCViewer.ViewerControl~SearchTerm|PCCViewer.ViewerControl~ProximitySearchTerm}
Gets the search term object from the searchQuery
object that was passed to the PCCViewer.SearchTask constructor.
If a string was passed to the PCCViewer.SearchTask constructor, then this will return a PCCViewer.ViewerControl~SearchTerm object generated from the string.
The returned object will be augmented with all options used for searching.
Returns:
The search term of the search result.
Example
var mark1 = viewerControl.addMark(1, "TextAnnotation");
mark1.setText("When Full-Text Search is being installed for an existing client without Full-Text Search");
var searchTask = new PCCViewer.SearchTask(searchQuery);
var results = searchTask.search(mark1.getText());
var result = results[0];
var searchTerm = result.getSearchTerm();
alert("This search result matched the search term: " + searchTerm.searchTerm);
getStartIndexInContext() → {number}
Gets the start index of the search result text within the context text returned by PCCViewer.SearchResult#getContext.
Returns:
The start index of the search result text within the context text.
- Type
- number
Example
var mark1 = viewerControl.addMark(1, "TextAnnotation");
mark1.setText("When Full-Text Search is being installed for an existing client without Full-Text Search");
var searchTask = new PCCViewer.SearchTask(searchQuery);
var results = searchTask.search(mark1.getText());
var result = results[0];
var startIndex = result.getStartIndexInContext();
getStartIndexInContext() → {number}
Gets the start index of the search result text within the context text returned by PCCViewer.SearchResult#getContext.
Returns:
The start index of the search result text within the context text.
- Type
- number
Example
var mark1 = viewerControl.addMark(1, "TextAnnotation");
mark1.setText("When Full-Text Search is being installed for an existing client without Full-Text Search");
var searchTask = new PCCViewer.SearchTask(searchQuery);
var results = searchTask.search(mark1.getText());
var result = results[0];
var startIndex = result.getStartIndexInContext();
getStartIndexInInput() → {number}
Gets the start index of the search result text, within the entire text string
- See:
-
- Use PCCViewer.SearchTaskResult#getText to get the matched text of the search result.
Returns:
The start index of the matched text in the provided text string to be searched.
- Type
- number
Example
var mark1 = viewerControl.addMark(1, "TextAnnotation");
mark1.setText("When Full-Text Search is being installed for an existing client without Full-Text Search");
var searchTask = new PCCViewer.SearchTask(searchQuery);
var results = searchTask.search(mark1.getText());
var result = results[0];
var startIndex = result.getStartIndexInInput();
alert("The search result starts a character " + startIndex + " in the text string.");
getStartIndexInInput() → {number}
Gets the start index of the search result text, within the entire text string
- See:
-
- Use PCCViewer.SearchTaskResult#getText to get the matched text of the search result.
Returns:
The start index of the matched text in the provided text string to be searched.
- Type
- number
Example
var mark1 = viewerControl.addMark(1, "TextAnnotation");
mark1.setText("When Full-Text Search is being installed for an existing client without Full-Text Search");
var searchTask = new PCCViewer.SearchTask(searchQuery);
var results = searchTask.search(mark1.getText());
var result = results[0];
var startIndex = result.getStartIndexInInput();
alert("The search result starts a character " + startIndex + " in the text string.");
getText() → {string}
Gets the search result text. This is the text that matched the search query/term.
Returns:
The search result text.
- Type
- string
Example
var mark1 = viewerControl.addMark(1, "TextAnnotation");
mark1.setText("When Full-Text Search is being installed for an existing client without Full-Text Search");
var searchTask = new PCCViewer.SearchTask(searchQuery);
var results = searchTask.search(mark1.getText());
var result = results[0];
var text = result.getText();
alert("Search matched the text: " + text);
getText() → {string}
Gets the search result text. This is the text that matched the search query/term.
Returns:
The search result text.
- Type
- string
Example
var mark1 = viewerControl.addMark(1, "TextAnnotation");
mark1.setText("When Full-Text Search is being installed for an existing client without Full-Text Search");
var searchTask = new PCCViewer.SearchTask(searchQuery);
var results = searchTask.search(mark1.getText());
var result = results[0];
var text = result.getText();
alert("Search matched the text: " + text);