Skip to content

Conversation

@gotlougit
Copy link
Contributor

This is with reference to issue #172, where I proposed adding a search function to search for a specific subcommand for a given program

For example, searching for how to delete a branch in git can be done using this feature, using the command

tldr git --search "delete branch"

Keep in mind that the very first word you type is the most impactful when trying to decide the most relevant page, the second one less so and so on and so forth.

While the search algorithm I've devised seems to work fairly well, there are some further enhancements I am looking to implement as well:

  • Searching for the keywords only in the examples given and not the command/subcommand summary

  • Highlighting the keywords wherever they are found in the text or only printing the examples where the keywords have been found.

  • Any code cleanup operations that need to be performed

  • Improvements to the search algorithm

I used this to try to get more familiar with the code, but it's of no
use now
@gotlougit
Copy link
Contributor Author

I've made some improvements, like making sure each word has same importance when calculating the score of each page, conforming to the style requirements, and adding a no results found message.

I am looking for more feedback on the search feature since I do want to improve it and also get it into the project.

gotlougit and others added 4 commits November 22, 2021 06:57
Co-authored-by: Matthew Peveler <[email protected]>
Co-authored-by: Matthew Peveler <[email protected]>
This way, we save a lot of time and prevent the program from being
locked up downloading lots of pages and searching through them.
However, the final page may still be downloaded in case cache isn't up
to date enough. This should be fixed by adding a check to see if cache
is up to date or not, but the provided function didn't make a whole
bunch of sense to me. Hopefully someone else can provide needed info
here.
@gotlougit
Copy link
Contributor Author

gotlougit commented Nov 30, 2021

This new commit only searches through cache, but may need some more handling of edge cases (like if someone forcibly deletes the cache directory). However such cases seem to be pretty few and far between, so I think it's fine.

@gotlougit gotlougit requested a review from MasterOdin December 20, 2021 03:43
@MasterOdin MasterOdin merged commit 0318102 into tldr-pages:main Dec 22, 2021
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.

3 participants