Improving the MODX Documentation

:mag_right: I just deployed a first version of the search :tada:

Try it: Search the documentation | MODX Documentation

Iā€™m especially interested in feedback on how well (or not) itā€™s finding what youā€™re looking for, so try finding things youā€™d normally search for, and let me know if the results are what you expect.

Itā€™s a custom built search/indexer which uses fuzzy matching and a scoring system.

The numbers you see in each result (e.g ā€œ37 = 92/100ā€) reflect the score; a score of 40 (100/100) or higher is considered a confident result, a good match. Scores are assigned per matching word. Right now, a match in the page title is 10 points, matches in the other headers are 4 points (limited to 20 points for 5 occurrences in all headings), and body content is 1 point (limited to 20 points for 20 occurrences). Iā€™ll probably play with these numbers a bit still though.

At the moment, only English docs for 2.x are indexed, so no results for 3.x or Russian/Dutch is expected (coming soon!). Some other things Iā€™ll be working on include showing an extract of the result page, pagination, reindexing changed documentation, perhaps some more control over the fuzzy matching, and the code needs cleaning up and restructuring to make it easier to extend down the road.

3 Likes

Well done, Mark. Works well!

From a UX standpoint, a brief description/extract of the results might be more useful than the score. I would even drop the score altogether. But If you must keep it, you should reduce its font-size and use a muted gray color.

Also, the search doesnā€™t return the If extra, probably due to the minimum character number being higher than 2, which is understandable.

And, the search finds 623 results for the term MODX, but not all are returned.

Iā€™ll post more as I find them.

Thanks for trying it :slight_smile:

It looks like ā€œIfā€ isnā€™t indexed because itā€™s a stopword; i.e. too commonly used in sentences that itā€™s filtered out as not having any real meaning. Like ā€œaā€ and ā€œtheā€. It does show up when searching for ā€œconditionā€. Maybe Iā€™ll take ā€œifā€ out of the stopword list as that does have some real meaning for usā€¦

It definitely isnā€™t done yet; like I mentioned showing an extract and adding pagination to see more than 10 results is still on the to do list.

Totally missed the to do list part. If not being indexed makes sense.

Another update for the search is now running on the site, e.g.: 99 results for "friendly urls" | MODX Documentation

Changes:

  • It looks better now! :slight_smile:
  • Shows an extract of the page. Currently the start of the page body; might change it to get the relevant portion of the page instead later.
  • Shows breadcrumbs leading to a page for a bit of very useful context (e.g. search for ā€œroadmapā€)
  • Pagination added, so you can see beyond the first 10 results.
  • The search now uses 100% of the weight on exact matches, and 75% for fuzzy matches (e.g. searching for friendly urls will use 100% of the weight for urls, but 75% of the weight for url).
  • Itā€™s now possible to quote individual words to force it to only use the exact match, e.g. friendly "urls". The search page will also tell you thatā€™s possible when fuzzy matches are used.
  • The score is shown more subtly now, but can also be clicked to get a bit more insight into why a certain page has a certain score.
  • If words are ignored because theyā€™re too short or a stopword, it will now tell you. (e.g. search for ā€œifā€ or ā€œwhat is a modxā€)

Still more to be done but it should be a lot more user friendly with this update :slight_smile:

6 Likes

This is a vast improvement. Well done!

2 Likes

Excellent updates. :slight_smile:

1 Like

The awesome @lkfranklin has been working on updated/new docs explaining how to integrate templates: https://docs.modx.org/current/en/building-sites/integrating-templates

1 Like

Iā€™ve updated the searching algorithm to also match on terms that youā€™re starting to type (e.g. synt will ā€œautocompleteā€ to syntax). Thatā€™s not a fuzzy search (e.g. gertes wont figure out youā€™re typing getresources) but does help with another new search featureā€¦ live results as you type:

Search does need some work on mobile, so thatā€™s next.

5 Likes

Exciting milestone - the legacy docs have now been replaced with this new system and content on docs.modx.com! Thatā€™s now on hardware sponsored by MODX LLC.

Iā€™ll keep docs.modx.org running as a mirror (and probably rename it to docs-mirror.modx.org with a note at the top or such providing a link to the official version). The canonical is already updated, so search results should update automatically as well.

3 Likes

Looks beautiful. :1st_place_medal:

BTW, Iā€™ve been trying to add UpgradeMODX for some time with no luck. Iā€™m hoping I can do it at the new site once I have access.

Who needs access? :wink: You can send a pull request to add a new directory in Docs/en/extras at 2.x Ā· modxorg/Docs Ā· GitHub

Some information on file naming and structures and such can be found here: Documentation - Contribute to MODX | MODX Documentation

1 Like

Thanks! Iā€™ll give that a try.

1 Like

By popular request, thereā€™s now an improved language/version switcher in the top right (top left on mobile). Based on initial work a while ago by @christianseel, which Iā€™ve tried to not mess up too much. :wink:

The options point to the current page in the other language if available (that used to be right below the documentation title before), or if that page was not translated (like for Dutch in this example) it points to the index of that translation instead.

4 Likes