Add say/who to the Lunr exception list. Add setting to extend the list from gamedir.

This commit is contained in:
Griatch 2022-02-09 23:03:08 +01:00
parent a58b667bb0
commit 2c3b82ac4a
3 changed files with 12 additions and 1 deletions

View file

@ -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. - Homogenize manager search methods to return querysets and not lists.
- Restructure unit tests to always honor default settings; make new parents in - Restructure unit tests to always honor default settings; make new parents in
on location for easy use in game dir. 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 ## Evennia 0.9.5

View file

@ -5,13 +5,17 @@ sub-categories.
This is used primarily by the default `help` command. This is used primarily by the default `help` command.
""" """
from django.conf import settings
import re import re
# these are words that Lunr normally ignores but which we want to find # these are words that Lunr normally ignores but which we want to find
# since we use them (e.g. as command names). # since we use them (e.g. as command names).
# Lunr's default ignore-word list is found here: # Lunr's default ignore-word list is found here:
# https://github.com/yeraydiazdiaz/lunr.py/blob/master/lunr/stop_word_filter.py # 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 = None
_LUNR_EXCEPTION = None _LUNR_EXCEPTION = None

View file

@ -650,6 +650,11 @@ FILE_HELP_ENTRY_MODULES = ["world.help_entries"]
# if topics listed in help should be clickable # if topics listed in help should be clickable
# clickable links only work on clients that support MXP. # clickable links only work on clients that support MXP.
HELP_CLICKABLE_TOPICS = True 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 # FuncParser