Options
All
  • Public
  • Public/Protected
  • All
Menu

This interface serves as an entry-point for all APIs related to searching in ReaderDocuments.

You can retrieve an instance of this interface by calling ReadingSystemEngine.getReaderDocumentSearch().

Hierarchy

  • IReaderDocumentSearch

Index

Methods

createCustomQuery

  • Creates a new custom search query using the specified queryMatcher.

    Use this method if you have implemented your own IReaderDocumentSearchQueryMatcher that you wish to use when searching in ReaderDocuments.

    If you want to do a basic text search, use createTextQuery instead.

    Parameters

    Returns IReaderDocumentSearchQuery

createReaderViewSearchAgent

  • Creates a new IReaderViewSearchAgent using the specified annotationLayer. Use an IReaderViewSearchAgent to highlight search matches in the ReaderView.

    When you provide the IReaderViewSearchAgent with a search query, the agent will use the query to search the visible ReaderDocuments in the ReaderView. For each found search match, the agent creates a ReaderViewAnnotation. The agent will continue to search, add and remove ReaderViewAnnotations as necessary when the ReaderView is navigated.

    Note that, the search agent will not modify any options on the annotationLayer. You need to manually configure the ReaderViewAnnotationLayer by calling annotationLayer.setLayerOptions() and annotationLayer.setDefaultAnnotationOptions.

    The following example shows how to highlight all search matches:

    // Create the annotation layer used for highlighting search results.
    const annotationLayer = readerView.createAnnotationLayer('searchHighlights');
    annotationLayer.setLayerOptions({
    layerStyle: {
    'mix-blend-mode': 'multiply',
    },
    });
    annotationLayer.setDefaultAnnotationOptions({
    rangeStyle: {
    'background-color': 'lightblue',
    },
    });

    const readerDocumentSearch = readingSystemEngine.getReaderDocumentSearch();

    // Create the query
    const textQuery = readerDocumentSearch.createTextQuery('Paris');

    // Create a search agent that will highlight all matches using the annotation layer.
    const searchAgent = readerDocumentSearch.createReaderViewSearchAgent(annotationLayer);
    searchAgent.setSearchQuery(textQuery);

    Parameters

    Returns IReaderViewSearchAgent

createTextQuery

  • Creates a new text search query using the specified queryString. The search will be performed using a variant of exact matching, but with special handlig for whitespace and case-sensitivity, etc. Please see ITextSearchQueryOptions for available options. No control words such as "AND" or "OR" is supported.

    If you want to support more advanced search queries, you can implement your own IReaderDocumentSearchQueryMatcher and use it with createCustomQuery() instead.

    Parameters

    • queryString: string

      The exact string to search for.

    • Optional options: ITextSearchQueryOptions

      Options controlling how matching is performed, and what data that is available in search result items.

    Returns IReaderDocumentSearchQuery

destroyReaderViewSearchAgent

  • Destroys an IReaderViewSearchAgent previously created with createReaderViewSearchAgent(). This will cause the agent to remove all ReaderViewAnnotations it has created, and release any used resources.

    Note that, annotationLayer passed to createReaderViewSearchAgent() will not be destroyed by this method. Call readerView.destroyAnnotationLayer() with the annotationLayer to destroy it.

    Parameters

    Returns void

Generated using TypeDoc