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

Improve help search matching #3533

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

chiizujin
Copy link
Contributor

Brief overview of PR changes/additions

If help entries have similar names, it may be impossible to access one or more of them. This change fixes that, resolving #3532.

Motivation for adding to Evennia

Improvement/bug fix.

Other info

This seems to be related to lunr and is further complicated by the fact that commands can be prefixed with "@".

In the case of "test" and "tests", lunr ranks both of these the same, no matter which is searched for:

help test
{'ref': 'test', 'score': 44.819, 'match_data': <MatchData "test">}
{'ref': 'tests', 'score': 44.819, 'match_data': <MatchData "test">}

help tests
{'ref': 'test', 'score': 44.819, 'match_data': <MatchData "test">}
{'ref': 'tests', 'score': 44.819, 'match_data': <MatchData "test">}

I don't know if this PR is the most elegant fix but I couldn't find any lunr-based solution.

Examples

Before:

>help test
Help for test
(...)
Other topic suggestions:
tests

>help tests
Help for test
(...)
Other topic suggestions:
tests
>help spawn
Help for spawns
(...)
Other topic suggestions:
spawn

>help spawns
No help found

There is no help topic matching 'spawns'.
... But matches were found within the help texts of the suggestions below.

Other topic suggestions:
spawn  spawns

Example from the bug report:

>help interactions
Help for interact
(...)
Other topic suggestions:
interactions

>help interact
Help for interact
(...)
Other topic suggestions:
interactions

After:

>help test
Help for test
(...)
Other topic suggestions:
tests

>help tests
Help for tests
(...)
Other topic suggestions:
test
>help spawn
-------------------------------------------------------------------------------------
Help for spawn (aliases: olc)
(...)
Other topic suggestions:
spawns

>help spawns
-------------------------------------------------------------------------------------
Help for spawns
(...)
Other topic suggestions:
spawn
>help interact
Help for interact
(...)
Other topic suggestions:
interactions

>help interactions
Help for interactions
(...)
Other topic suggestions:
interact

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.

None yet

1 participant