diff --git a/CHANGELOG.md b/CHANGELOG.md index d3b02f135e..04c83b664b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -145,6 +145,8 @@ Up requirements to Django 4.0+, Twisted 22+, Python 3.9 or 3.10 - Homogenize manager search methods to return querysets and not lists. - Restructure unit tests to always honor default settings; make new parents in on location for easy use in game dir. +- The `Lunr` search engine used by help excludes common words; the settings-list + `LUNR_STOP_WORD_FILTER_EXCEPTIONS` can be extended to make sure common names are included. ## Evennia 0.9.5 diff --git a/evennia/help/utils.py b/evennia/help/utils.py index 0fc3fafce1..981aea1fd0 100644 --- a/evennia/help/utils.py +++ b/evennia/help/utils.py @@ -5,13 +5,17 @@ sub-categories. This is used primarily by the default `help` command. """ +from django.conf import settings import re # these are words that Lunr normally ignores but which we want to find # since we use them (e.g. as command names). # Lunr's default ignore-word list is found here: # https://github.com/yeraydiazdiaz/lunr.py/blob/master/lunr/stop_word_filter.py -_LUNR_STOP_WORD_FILTER_EXCEPTIONS = ("about", "might", "get") +_LUNR_STOP_WORD_FILTER_EXCEPTIONS = ( + ["about", "might", "get", "who", "say"] + settings.LUNR_STOP_WORD_FILTER_EXCEPTIONS +) + _LUNR = None _LUNR_EXCEPTION = None diff --git a/evennia/settings_default.py b/evennia/settings_default.py index ecfd723405..964b255db8 100644 --- a/evennia/settings_default.py +++ b/evennia/settings_default.py @@ -650,6 +650,11 @@ FILE_HELP_ENTRY_MODULES = ["world.help_entries"] # if topics listed in help should be clickable # clickable links only work on clients that support MXP. HELP_CLICKABLE_TOPICS = True +# The Lunr search engine (used by help) excludes 'common' words from its search. +# This is not so good when those words are names of commands, like who or say; +# so we need to make sure to tell Lunr to not filter them out by adding them here +# (many are auto-added out of the box, this extends the list). +LUNR_STOP_WORD_FILTER_EXCEPTIONS = [] ###################################################################### # FuncParser