def existence_search(client, flat_name, names, value):
    """Create a search for existence or non existence of a field, if the value
    is * or -*.

    """
    if value == '':
        return (client.field(flat_name).exists(),
                '%s exists' % (':'.join(names), ))
    elif value == '*':
        return (client.field(flat_name).nonempty(),
                '%s is non-empty' % (':'.join(names), ))
    elif value == '-*':
        return (client.field(flat_name).empty(),
                '%s exists but is empty' % (':'.join(names), ))

    return None