Skip to content

documentation search bar#8

Open
fiumals wants to merge 13 commits intomuse-sequencer:masterfrom
fiumals:master
Open

documentation search bar#8
fiumals wants to merge 13 commits intomuse-sequencer:masterfrom
fiumals:master

Conversation

@fiumals
Copy link
Copy Markdown
Contributor

@fiumals fiumals commented Apr 27, 2026

hello :)

I thought it would be useful to have a search bar in the documentation to search all articles at once for a word or phrase, so i've been working on one, it looks like this

image image

Also replaced the "Return to Homepage" link with the MusE Sequencer logo and title similar to the homepage, when clicked it still does return to the homepage though

A few things:

  • It relies on a search_index.json file in the same directory as the other html files, which contains the text contents for most of the html files in that same directory, this json file gets fetched when on search.html with javascript
  • The search_index.json is generated via the python script in docs/util_scripts/generate_search_index.py, which currently needs to be ran manually when an article is modified
  • i also tampered with some core css rules to fix some margins in the mobile design but generally everything looks almost the same i think

let me know if anything needs adjusting!

fiumals added 6 commits April 13, 2026 01:10
added search.html for search results, added mini search bar to the sidebar and replaced Return to homepage with the logo and MusE Documentation text
added the searchbar to the spanish translation as well, search works by
fetching the contents of the search_index.json files which are generated
via the python script at docs/util_scripts/generate_search_index.py,
this script indexes the articles with the class "articlelink" in the
contents.html file
added a comment explaining a little bit of what it does and made it accept a directory as an argument too
to make it get the title from its text in contents.html instead of the article's first h1 element (i should have thought about this before)
@terminator356
Copy link
Copy Markdown
Member

Hi sorry for the delay. Busy few days.

Just a quick question:
How does all of this affect adding new content?
If I add new text, or a new heading, will I have to do anything more?
Should it 'just work'?

Thanks.

@fiumals
Copy link
Copy Markdown
Contributor Author

fiumals commented Apr 30, 2026

Hey! No problem, I figured you must be busy with other stuff.

As of now anytime you edit text or add new entries to the sidebar, the search_index.json needs to be updated by running a python script i wrote in docs/util_scripts/generate_search_index.py (should be ran from inside /docs directory), but aside from that nothing else should be needed afaik.

When making changes you would also need to commit that updated search_index.json file to have up to date search results though. I think it might be possible to automate updating the search index with github actions but to be honest I don't know much about how to use them yet, If you prefer I could look into that though! It might be more convenient

@terminator356
Copy link
Copy Markdown
Member

Sure that would be great.

If no success, some clear instructions on what to do after a modification would be good.
Not sure where they could reside. Top code folder README.wiki?
On the documentation site itself?
If I recall there is a section 'helping out', or something like that, which describes how to edit the content,
how to clone it, edit it, push etc.
That might be a great place to append these new instructions.

I'll wait a bit to see what you find.

fiumals and others added 7 commits May 1, 2026 16:29
also changed the index generation script to work regardless of where it was executed from, and added instructions on the wikiedit on how to update the search indexes manually (though the workflow should take care of that)
the bot wasn't commiting it
@fiumals
Copy link
Copy Markdown
Contributor Author

fiumals commented May 1, 2026

Hello! i looked into workflows today and made one that takes care of the search generation when you submit any changes, i also set it to commit the generated index to the repository so that when you pull the changes offline the search is up to date when running the site locally as well.

I tested it by modifying some files myself without manually generating the search_index, and it seems to work fine, the search gets updated on its own, no extra steps should be needed now when modifying the wiki. I did add a section in "Editing this Wiki", explaining how to generate the search_index manually, but normally you wouldn't need to do so.

I believe you would have to make sure that the build and deployment source in the repository settings is set to "github actions" instead of "deploy from a branch" before merging though

let me know if anything else! I'd be glad to help :)

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.

2 participants