Search ranking issue: more complete match ranked lower
I have classes
- InvoiceDetailView
- TestInvoiceDetailView
When I search tags through ctrlp with "InvoiceDetail", then TestInvoiceDetailView is ranked higher than InvoiceDetailView. That is not what I would have expected. I see two arguments why it should be the other way around:
- Search term matches the start if InvoiceDetailView and not TestInvoiceDetailView
- Search term covers a larger part of the matched string InvoiceDetailView than TestInvoiceDetailView and is therefor a closer match
Am I missing some configuration, or is the ranking done in some other way, that I was not expecting?
(On a side note: I love this plugin. Couldn't do without it!)
@eldamir let me have a try
It seems to be true of any (Python) classes where I have an identical class name with a prefix of "Test". It always displays the test class first

it seem works well for me ,if i type into InvoiceDetail my cursor is located on InvoiceDetailView,java
ok let me try will py
When I start seaching, initially, the test won't show up:

As I type, it shows up

And keeps getting ranked first

Admittedly, a ton of classes contain the word "Invoice", but "InvoiceDetail" is specific to just those two
also works well ,you could see my cursor on InvoiceDetailView.py

how do you set g:ctrlp_custom_ignore and your match
maybe the path to the file matters? Mine are
/home/ruben/workspace/v3/web/views/invoice.py::InvoiceDetailView
/home/ruben/workspace/v3/web/tests/test_invoices.py::TestInvoiceDetail
can you show me you vimrc ,if possible,
my ctrlp specific configs are
if executable('ag')
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
endif
set runtimepath^=~/.vim/bundle/ctrlp.vim
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/](\.git|node_modules|\.sass-cache|bower_components|build|media|__pycache__)$',
\ 'file': '\v\.(exe|so|dll|pyc)$',
\ 'link': 'some_bad_symbolic_links',
\ }
Though commenting them away doesn't change the result
NeoBundle 'FelikZ/ctrlp-py-matcher'
let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' }
can you try to use this matcher?
i just use your setting but can not reproduce,the diff is my matcher
and i am using ag -i instead of ag -l
same result, although coloured differently

here is my ctrlp setting
NeoBundle 'ctrlpvim/ctrlp.vim'
NeoBundle 'FelikZ/ctrlp-py-matcher'
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_root_markers = 'pom.xml'
let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:25,results:25'
let g:ctrlp_show_hidden = 1
"for caching
let g:ctrlp_use_caching = 1
let g:ctrlp_clear_cache_on_exit = 0
let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp'
"let g:ctrlp_map = ',,'
"let g:ctrlp_open_multiple_files = 'v'
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.class,tags
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$|target',
\ 'file': '\v\.(exe|so|dll|ttf|png)$',
\ 'link': 'some_bad_symbolic_links',
\ }
let g:ctrlp_user_command = ['ag %s -i --nocolor --nogroup --hidden
\ --ignore out
\ --ignore .git
\ --ignore .svn
\ --ignore .hg
\ --ignore .DS_Store
\ --ignore "**/*.pyc"
\ -g ""'
\ ]
let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' }
yelds Variable type mismatch for: g:ctrlp_user_command for me
vim variable should not be defind in diff type ,you can comment you setting for g:ctrlp_user_command
it is due to i am using a list as it's value
I don't understand. Would you mind giving me an example I can just paste to my vimrc?
ok do you using neobundle?
I use vundle
set nocompatible
syntax on
filetype off
set rtp+=~/.vim/bundle/Vundle.vim/
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'FelikZ/ctrlp-py-matcher'
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_root_markers = 'pom.xml'
let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:25,results:25'
let g:ctrlp_show_hidden = 1
"for caching
let g:ctrlp_use_caching = 1
let g:ctrlp_clear_cache_on_exit = 0
let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp'
"let g:ctrlp_map = ',,'
"let g:ctrlp_open_multiple_files = 'v'
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.class,tags
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$|target',
\ 'file': '\v\.(exe|so|dll|ttf|png)$',
\ 'link': 'some_bad_symbolic_links',
\ }
let g:ctrlp_user_command = ['ag %s -i --nocolor --nogroup --hidden
\ --ignore out
\ --ignore .git
\ --ignore .svn
\ --ignore .hg
\ --ignore .DS_Store
\ --ignore "**/*.pyc"
\ -g ""'
\ ]
let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' }
call vundle#end()
filetype plugin indent on
same error :frowning:
but why? it works well for me ,i have just use this script without anything others.
maybe it is better copy this class into ~/Test/ and try again
Hmm.. I'll give it a shot at a later time. My head is swimming at the moment. Thanks for your quick response and suggestions :+1:
welcome,also it is better use this active fore https://github.com/ctrlpvim/ctrlp.vim