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

Only first occurrence within file is displayed #22

Open
m-kru opened this issue Jun 8, 2023 · 5 comments
Open

Only first occurrence within file is displayed #22

m-kru opened this issue Jun 8, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@m-kru
Copy link

m-kru commented Jun 8, 2023

I have realized that only first occurrence within file is displayed. Is this intentional behavior?

@m-kru
Copy link
Author

m-kru commented Jun 8, 2023

Ok, I see I have to provide -s N argument. The default value is 1. To be honest I do not think this is desired default behavior. Shouldn't it default to "all"?

@m-kru
Copy link
Author

m-kru commented Jun 8, 2023

Another observation -s does not work in interactive TUI mode.

@boyter
Copy link
Owner

boyter commented Jun 8, 2023

Its not the first occurrence, but what is considered the most relevant one. Which of course depends on the terms entered, their relative frequency in the corpus being searched, how close they are together etc...

From the README

It works by passing the document content to extract the snippet from and all the match locations for each term. It then looks through each location for each word, and checks on either side looking for terms close to it. It then ranks on the term frequency for the term we are checking around and rewards rarer terms. It also rewards more matches, closer matches, exact case matches and matches that are whole words.

This is the intended default behavior. If you are looking for all the matches something like rg TERM | fzf is an existing option to achieve this.

As for them not working in TUI mode... that I am aware of. It is something I want to include. Ill leave this open to track that particular issue.

@boyter boyter added the enhancement New feature or request label Jun 8, 2023
@m-kru
Copy link
Author

m-kru commented Jun 9, 2023

Is there any option in TUI to select given file and jump over occurrences? It also would be nice to display how many occurrence have been found.

@boyter
Copy link
Owner

boyter commented Jun 14, 2023

Not currently. I think that could be a decent addition to have though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants