Repository navigation
Conversation
|
Thanks for working on it! I am not sure if an option is the best way to handle it to be honest. If current behavior considered counter-intuitive (which I agree with) then wouldn't the best way to handle it -- make it intuitive? |
|
Not really. Because camel case is used for extra points. This works in most languages. And there is no option to control the extra points behavior. So can only do this.. In short, it is useful when your style requires camelCase. It is not so useful when you use fuzzy in some tools. |
|
But even in camelCase, I would still expect to rank |
|
as in here: |
|
|
compare following results: For the first one I remember you did the fix without adding additional option. In the second case I don't understand why My understanding is that match at beginning of the string should be considered higher than match somewhere in the middle even if it is camelCase. |
|
I mean if camelCase is more important than match at beginning then I would just accept it and let's not introduce a new option. |
CamelCase here just checks if the letter before |
Yes I get it. What I don't get why we can't check if letter before |
|
idk it's from the fts port. I think it's probably reasonable in most cases from the programming language naming perspective. It's a bit weird outside of other scenarios. So we need some fields to control the granularity of the score. For example camelcase.. |
|
For me it looks like And comment about fuzzy speaks about it as well: Single words care about consecutive matches but not separators or camel case This might be lost in implementation? |
|
consecutive_camel is something I added in my previous PR. Modifying FIRST_LETTER_BONUS is not the right approach. I think we need to control the granularity of the bonus points. Secondly, we should also consider whether the words are matched continuously from the beginning. There should be extra bonus points. I will try to implement it later. |
It is just an example of adding the same bonus as CAMEL_CASE to the match at start.
Thanks! |
It would probably be better to add same bonus for match at start of the word as for camelCase, wouldn't it? |
|
idea is to give extra points to consecutive words, for example, the score of 3 consecutive positions is greater than 2 consecutive positions. may have to try it out to know the specific behavior. |
maybe, although for me this looks tempting: |
yep it works and is pretty simple. But I guess the problem is the lack of bonus points for consecutive matches like there are for exact matches. |
|
@habamax I have updated the algorithm here. How do you feel about it ? |
|
@glepnir looks promising Thank you! |
|
note that now following sorts I would assume shorter string should have higher rank? |
|
Sry... I made a mistake. |
|
change to 60 this not works I think it is necessary to control the scoring behavior when we use this search tool. Add fields to matchfuzzy. Secondly, the current algorithm. When 3 consecutive let consecutive affect camelcase.. |
Why? It works fine... |
|
Oh this is wrong |
Well, apparently, because sorting is changed, some of the test cases would be wrong. And the weight for first letter is the subject for discussion. Maybe if we make is a bit higher than camelCase, say 65, it would be sorted better? Like in this case result would be: |
|
But I would leave it with 60, same as what is used for camelCase |
|
I feel the problem is not here... The bonus points need to be controlled in different usage scenarios. So why can't camelcase be used in matchfuzzy as a field? You use it in the tool without considering CamelCase, right? Secondly, I think the current algorithm is also OK. Because the tool input sequence score is changing. The input reading accuracy will also be higher, right? So when the order of 1 or 2 characters is wrong... |
|
I think you might be right and we need to control it with an option/parameter to the function. The way you did it initially. |
|
Yes. the default camelcase bouns are weird and cause a lot of strange visual effects. |
Agree, and we probably wouldn't be able to easily fix/improve it to not interfere with other things. So yeah, I think now that your initial approach was correct. |
7396fd7 to
296715e
Compare
|
I have just tested it with |
Problem: When searching for Cur, CamelCase matches like lCursor score higher than exact prefix matches like Cursor, which is counter-intuitive. Solution: Add a 'camelcase' option to matchfuzzy() that lets users disable CamelCase bonuses when needed, making prefix matches rank higher.
296715e to
e6e17a0
Compare
|
thanks |
Problem: When searching for "Cur", CamelCase matches like "lCursor" score
higher than exact prefix matches like Cursor, which is
counter-intuitive (Maxim Kim).
Solution: Add a 'camelcase' option to matchfuzzy() that lets users disable
CamelCase bonuses when needed, making prefix matches rank higher.
(glepnir)
fixes: vim/vim#16504
closes: vim/vim#16797
vim/vim@28e40a7
Co-authored-by: glepnir <[email protected]>
Problem: When searching for "Cur", CamelCase matches like "lCursor" score
higher than exact prefix matches like Cursor, which is
counter-intuitive (Maxim Kim).
Solution: Add a 'camelcase' option to matchfuzzy() that lets users disable
CamelCase bonuses when needed, making prefix matches rank higher.
(glepnir)
fixes: vim/vim#16504
closes: vim/vim#16797
vim/vim@28e40a7
Co-authored-by: glepnir <[email protected]>
Problem: When searching for "Cur", CamelCase matches like "lCursor" score
higher than exact prefix matches like Cursor, which is
counter-intuitive (Maxim Kim).
Solution: Add a 'camelcase' option to matchfuzzy() that lets users disable
CamelCase bonuses when needed, making prefix matches rank higher.
(glepnir)
fixes: vim/vim#16504
closes: vim/vim#16797
vim/vim@28e40a7
Co-authored-by: glepnir <[email protected]>
Problem: When searching for "Cur", CamelCase matches like "lCursor" score
higher than exact prefix matches like Cursor, which is
counter-intuitive (Maxim Kim).
Solution: Add a 'camelcase' option to matchfuzzy() that lets users disable
CamelCase bonuses when needed, making prefix matches rank higher.
(glepnir)
fixes: vim/vim#16504
closes: vim/vim#16797
vim/vim@28e40a7
Co-authored-by: glepnir <[email protected]>
Problem: When searching for "Cur", CamelCase matches like "lCursor" score
higher than exact prefix matches like Cursor, which is
counter-intuitive (Maxim Kim).
Solution: Add a 'camelcase' option to matchfuzzy() that lets users disable
CamelCase bonuses when needed, making prefix matches rank higher.
(glepnir)
fixes: vim/vim#16504
closes: vim/vim#16797
vim/vim@28e40a7
Co-authored-by: glepnir <[email protected]>
This comment was marked as off-topic.
This comment was marked as off-topic.
|
I recently encountered a similar problem. I was also confused by the behavior of matchseq. After finishing other PRs |
Problem: When searching for "Cur", CamelCase matches like "lCursor" score
higher than exact prefix matches like Cursor, which is
counter-intuitive (Maxim Kim).
Solution: Add a 'camelcase' option to matchfuzzy() that lets users disable
CamelCase bonuses when needed, making prefix matches rank higher.
(glepnir)
fixes: vim/vim#16504
closes: vim/vim#16797
vim/vim@28e40a7
Co-authored-by: glepnir <[email protected]>

updated commit msg
Fix #16504