Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Search to Online and Offline Help #2262

Merged
merged 4 commits into from
Feb 5, 2025
Merged

Conversation

Delphinus8821
Copy link
Collaborator

Prerequisites

  • Reviewed the checklist

  • Reviewed feedback from the "Sonar Cloud" bot. Note that you have to wait
    for the "CI / Unit Tests") to complete first. Failed Unit tests can be
    debugged by adding the label "verbose logging" to the GitHub PR.

Description of the Change

Added the functionality from the MiniSearch project to add a search into online and offline help. This allows for users to search the help documentation from within the help webserver instead of having to navigate the table of contents or search from within Constellation.

This search stores the names of all of the help pages and which category they belong in according to the table of contents. E.g. searching the word 'analytics' will show all of the help pages for the analytics in the Analytic View. Searching 'view' will return help pages for the views.

Example of search suggestions:
image

Example of the results of a search:
image

To include the search for online help, a json file is required to hold all of the searchable data as the website for online help isn't able to generate this data like the application can. This will mean when new help pages are added, the search.json file will need to be updated manually, the same way the toc.md file currently is.

The online help search will not work until this PR, and a PR in the github.io repo have been merged and the documentation update script has been run,

As part of this PR, as the HTML used for creating the offline help pages needed to be edited and added to for adding in the search functionality, the HTML has been moved to a template to make the code easier to manage.

Also removed some of the scripts that were used when originally writing online and offline help that are no longer used.

Alternate Designs

The way that MiniSearch has been setup allows for Constellation to read the content from the table of contents file (toc.md) to create the json data required for the search. As the toc.md file only contains the title of each help page, the category they are part of and the link to the page, this is all of the data that the search currently has access to.

MiniSearch would be capable of storing and searching all of the data if we decided to include the content from every help page, but this would require having to read in every help page whenever offline help is run. Currently we don't have a way to access all of these help pages from within the code as the toc.md file only needs to access the toc.xml files for each module to be created. This could potentially be something to look into in the future.

Why Should This Be In Core?

Allows users to search for help pages from within the help webserver.

Benefits

Gives users an alternative way of navigating help. Makes help pages easier to find.

Possible Drawbacks

Creating the search data whenever Constellation opens the offline help documentation could potentially slow down the process of opening the offline help webserver but at this stage I have not noticed any performance issues.

Verification Process

Open Constellation and open a help page using offline help.
Type something into the search bar and observe both suggestions and results being shown (Use example above with the word 'analytics').
Click on one of the results and confirm the result loads the corresponding help page.

Applicable Issues

#1643
#1473

Copy link
Collaborator

@Quasar985 Quasar985 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it out and it works, just a few code smells from sonar

Copy link
Collaborator

@antares1470 antares1470 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of other changes:

  1. Could you please add a whatsnew entry for this?
  2. Could you update ATTRIBUTION.md so that to minisearch use is appropriately attributed

@@ -0,0 +1,967 @@
[{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we possibly get a comment at the beginning of the file here just to outline what needs to be done to update this file (noting from your PR description that this would now need to be updated manually)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a comment in ConstellationHelpDisplayer.createSearchDocument() explaining how this is updated as that's where the file is created

Copy link

sonarqubecloud bot commented Feb 3, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
6.6% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@mimosa2 mimosa2 self-requested a review February 3, 2025 01:37
Copy link
Collaborator

@mimosa2 mimosa2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. A minor suggestion. Is it possible to make the the search box a a bit shorter?

@Delphinus8821
Copy link
Collaborator Author

Looks good. A minor suggestion. Is it possible to make the the search box a a bit shorter?

I had a look at changing this but the suggestions list is hard to make the same width, so it looks weird having the search box shorter and the suggestions list being the full width

@antares1470 antares1470 merged commit ac9de3a into master Feb 5, 2025
2 of 3 checks passed
@antares1470 antares1470 deleted the feature/help-search branch February 5, 2025 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants