PrizmDoc v12.2 - March 9, 2017
Class: SearchTask

Class: SearchTask

PCCViewer. SearchTask

This object represent a search task, which can be used to perform searches on any text string.

The PCCViewer.SearchTask.search method on the PCCViewer.SearchTask object can be used to search text contained in the Mark and comments objects. It will also perform search on any other text string.

Constructor

new SearchTask(searchQuery)

Creates a SearchTask object used for searching any text string.

Parameters:
Name Type Description
searchQuery string | PCCViewer.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.

See:
Throws:
  • If search query is not a string or a valid PCCViewer.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 their 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 PCCViewer.SearchTask object
var searchTask = new PCCViewer.SearchTask(searchQuery);
// use the method PCCViewer.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

Searches any text string using the search criteria that were provided to the PCCViewer.SearchTask constructor.

Parameters:
Name Type Description
The string

text string to be searched.

Returns:

An array of PCCViewer.SearchTaskResult objects.

Type
Array.<PCCViewer.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 PCCViewer.SearchTask(searchQuery);
//search the textString
var results = searchTask.search(textString);

 

 


©2017. Accusoft Corporation. All Rights Reserved.

Send Feedback