class QHelpSearchEngine

The QHelpSearchEngine class provides access to widgets reusable to integrate fulltext search as well as to index and search documentation. More

Inheritance diagram of PySide6.QtHelp.QHelpSearchEngine

Synopsis

Methods

Slots

Signals

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description

Before the search engine can be used, one has to instantiate at least a QHelpEngineCore object that needs to be passed to the search engines constructor. This is required as the search engine needs to be connected to the help engines setupFinished() signal to know when it can start to index documentation.

After starting the indexing process the signal indexingStarted() is emitted and on the end of the indexing process the indexingFinished() is emitted. To stop the indexing one can call cancelIndexing() .

When the indexing process has finished, the search engine can be used to search through the index for a given term using the search() function. When the search input is passed to the search engine, the searchingStarted() signal is emitted. When the search finishes, the searchingFinished() signal is emitted. The search process can be stopped by calling cancelSearching() .

If the search succeeds, searchingFinished() is called with the search result count to fetch the search results from the search engine. Calling the searchResults() function with a range returns a list of QHelpSearchResult objects within the range. The results consist of the document title and URL, as well as a snippet from the document that contains the best match for the search input.

To display the given search results use the QHelpSearchResultWidget or build up your own one if you need more advanced functionality. Note that the QHelpSearchResultWidget can not be instantiated directly, you must retrieve the widget from the search engine in use as all connections will be established for you by the widget itself.

__init__(helpEngine[, parent=None])
Parameters:

Constructs a new search engine with the given parent. The search engine uses the given helpEngine to access the documentation that needs to be indexed. The QHelpEngine ‘s setupFinished() signal is automatically connected to the QHelpSearchEngine ‘s indexing function, so that new documentation will be indexed after the signal is emitted.

cancelIndexing()

Stops the indexing process.

cancelSearching()

Stops the search process.

hitCount()
Return type:

int

Note

This function is deprecated.

Use searchResultCount() instead.

hits(start, end)
Parameters:
  • start – int

  • end – int

Return type:

.list of std.pairQString,QString

Note

This function is deprecated.

Use searchResults() instead.

hitsCount()
Return type:

int

Note

This function is deprecated.

Use searchResultCount() instead.

indexingFinished()

This signal is emitted when the indexing process is complete.

indexingStarted()

This signal is emitted when indexing process is started.

query()
Return type:

.list of QHelpSearchQuery

Note

This function is deprecated.

Use searchInput() instead.

queryWidget()
Return type:

QHelpSearchQueryWidget

Returns a widget to use as input widget. Depending on your search engine configuration you will get a different widget with more or less subwidgets.

reindexDocumentation()

Forces the search engine to reindex all documentation files.

resultWidget()
Return type:

QHelpSearchResultWidget

Returns a widget that can hold and display the search results.

scheduleIndexDocumentation()
search(queryList)
Parameters:

queryList – .list of QHelpSearchQuery

Note

This function is deprecated.

Use search(const QString & searchInput ) instead.

search(searchInput)
Parameters:

searchInput – str

Starts the search process using the given search phrase searchInput.

The phrase may consist of several words. By default, the search engine returns the list of documents that contain all the specified words. The phrase may contain any combination of the logical operators AND, OR, and NOT. The operator must be written in all capital letters, otherwise it will be considered a part of the search phrase.

If double quotation marks are used to group the words, the search engine will search for an exact match of the quoted phrase.

For more information about the text query syntax, see SQLite FTS5 Extension .

searchInput()
Return type:

str

Returns the phrase that was last searched for.

searchResultCount()
Return type:

int

Returns the number of results the search engine found.

searchResults(start, end)
Parameters:
  • start – int

  • end – int

Return type:

.list of QHelpSearchResult

Returns a list of search results within the range from the index specified by start to the index specified by end.

searchingFinished(searchResultCount)
Parameters:

searchResultCount – int

This signal is emitted when the search process is complete. The search result count is stored in searchResultCount.

searchingStarted()

This signal is emitted when the search process is started.