-
-
Notifications
You must be signed in to change notification settings - Fork 109
Add search functionality #173
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
Conversation
I used this to try to get more familiar with the code, but it's of no use now
This fix should give better results and make the code easier to understand as well
|
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. |
Co-authored-by: CleanMachine1 <[email protected]>
Co-authored-by: Matthew Peveler <[email protected]>
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.
|
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. |
Co-authored-by: Matthew Peveler <[email protected]>
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