'Get a search index by path (instead of the default), or None if
no matching index is found.'

def get_path_index(self, session, path):

    idx = None
    (mi, mbox) = self.open_mailbox_path(session, path, raw_open=True)
    if mbox:
        idx = mbox.get_index(self, mbx_mid=mi)
    if (idx is None):
        import mailpile.index.base
        idx = mailpile.index.base.BaseIndex(self)
    return idx
